3737 SnapshotInfoLike ,
3838 SnapshotTableInfo ,
3939)
40+ from sqlmesh .utils import CompletionStatus
4041from sqlmesh .core .state_sync import StateSync
4142from sqlmesh .core .state_sync .base import PromotionResult
4243from sqlmesh .core .user import User
@@ -133,10 +134,14 @@ def evaluate(
133134 execution_time = plan .execution_time ,
134135 )
135136
136- self ._push (plan , snapshots , deployability_index_for_creation )
137+ push_completion_status = self ._push (plan , snapshots , deployability_index_for_creation )
138+ if push_completion_status .is_nothing_to_do :
139+ self .console .log_status_update (
140+ "\n [green]SKIP: No physical layer updates to perform[/green]\n "
141+ )
137142 update_intervals_for_new_snapshots (plan .new_snapshots , self .state_sync )
138143 self ._restate (plan , snapshots_by_name )
139- self ._backfill (
144+ first_bf_completion_status = self ._backfill (
140145 plan ,
141146 snapshots_by_name ,
142147 before_promote_snapshots ,
@@ -146,20 +151,22 @@ def evaluate(
146151 promotion_result = self ._promote (
147152 plan , snapshots , before_promote_snapshots , deployability_index_for_creation
148153 )
149- self ._backfill (
154+ second_bf_completion_status = self ._backfill (
150155 plan ,
151156 snapshots_by_name ,
152157 after_promote_snapshots ,
153158 deployability_index_for_evaluation ,
154159 circuit_breaker = circuit_breaker ,
155160 )
161+ if (
162+ first_bf_completion_status .is_nothing_to_do
163+ and second_bf_completion_status .is_nothing_to_do
164+ ):
165+ self .console .log_status_update ("[green]SKIP: No model batches to execute[/green]\n " )
156166 self ._update_views (
157167 plan , snapshots , promotion_result , deployability_index_for_evaluation
158168 )
159169
160- if not plan .requires_backfill :
161- self .console .log_success ("Virtual Update executed successfully" )
162-
163170 execute_environment_statements (
164171 adapter = self .snapshot_evaluator .adapter ,
165172 environment_statements = plan .environment_statements or [],
@@ -187,7 +194,7 @@ def _backfill(
187194 selected_snapshots : t .Set [str ],
188195 deployability_index : DeployabilityIndex ,
189196 circuit_breaker : t .Optional [t .Callable [[], bool ]] = None ,
190- ) -> None :
197+ ) -> CompletionStatus :
191198 """Backfill missing intervals for snapshots that are part of the given plan.
192199
193200 Args:
@@ -212,10 +219,10 @@ def _backfill(
212219 )
213220 )
214221 self .state_sync .add_snapshots_intervals (intervals_to_add )
215- return
222+ return CompletionStatus . NOTHING_TO_DO
216223
217224 if not plan .requires_backfill or not selected_snapshots :
218- return
225+ return CompletionStatus . NOTHING_TO_DO
219226
220227 scheduler = self .create_scheduler (snapshots_by_name .values ())
221228 completion_status = scheduler .run (
@@ -236,12 +243,14 @@ def _backfill(
236243 if completion_status .is_failure :
237244 raise PlanError ("Plan application failed." )
238245
246+ return completion_status
247+
239248 def _push (
240249 self ,
241250 plan : EvaluatablePlan ,
242251 snapshots : t .Dict [SnapshotId , Snapshot ],
243252 deployability_index : t .Optional [DeployabilityIndex ] = None ,
244- ) -> None :
253+ ) -> CompletionStatus :
245254 """Push the snapshots to the state sync.
246255
247256 As a part of plan pushing, snapshot tables are created.
@@ -268,10 +277,10 @@ def _should_create(s: Snapshot) -> bool:
268277
269278 snapshots_to_create = [s for s in snapshots .values () if _should_create (s )]
270279
271- completed = False
280+ completion_status = None
272281 progress_stopped = False
273282 try :
274- self .snapshot_evaluator .create (
283+ completion_status = self .snapshot_evaluator .create (
275284 snapshots_to_create ,
276285 snapshots ,
277286 allow_destructive_snapshots = plan .allow_destructive_models ,
@@ -281,7 +290,6 @@ def _should_create(s: Snapshot) -> bool:
281290 ),
282291 on_complete = self .console .update_creation_progress ,
283292 )
284- completed = True
285293 except NodeExecutionFailedError as ex :
286294 self .console .stop_creation_progress (success = False )
287295 progress_stopped = True
@@ -292,13 +300,16 @@ def _should_create(s: Snapshot) -> bool:
292300 raise PlanError ("Plan application failed." )
293301 finally :
294302 if not progress_stopped :
295- self .console .stop_creation_progress (success = completed )
303+ self .console .stop_creation_progress (
304+ success = completion_status is not None and completion_status .is_success
305+ )
296306
297307 self .state_sync .push_snapshots (plan .new_snapshots )
298308
299309 analytics .collector .on_snapshots_created (
300310 new_snapshots = plan .new_snapshots , plan_id = plan .plan_id
301311 )
312+ return completion_status
302313
303314 def _promote (
304315 self ,
0 commit comments