3737 SnapshotInfoLike ,
3838 SnapshotTableInfo ,
3939)
40+ from sqlmesh .core .scheduler import CompletionStatus
4041from sqlmesh .core .state_sync import StateSync
4142from sqlmesh .core .state_sync .base import PromotionResult
4243from sqlmesh .core .user import User
@@ -136,7 +137,7 @@ def evaluate(
136137 self ._push (plan , snapshots , deployability_index_for_creation )
137138 update_intervals_for_new_snapshots (plan .new_snapshots , self .state_sync )
138139 self ._restate (plan , snapshots_by_name )
139- self ._backfill (
140+ first_bf_completion_status = self ._backfill (
140141 plan ,
141142 snapshots_by_name ,
142143 before_promote_snapshots ,
@@ -146,20 +147,22 @@ def evaluate(
146147 promotion_result = self ._promote (
147148 plan , snapshots , before_promote_snapshots , deployability_index_for_creation
148149 )
149- self ._backfill (
150+ second_bf_completion_status = self ._backfill (
150151 plan ,
151152 snapshots_by_name ,
152153 after_promote_snapshots ,
153154 deployability_index_for_evaluation ,
154155 circuit_breaker = circuit_breaker ,
155156 )
157+ if (
158+ first_bf_completion_status .is_nothing_to_do
159+ and second_bf_completion_status .is_nothing_to_do
160+ ):
161+ self .console .log_status_update ("[green]SKIP: No model batches to execute[/green]\n " )
156162 self ._update_views (
157163 plan , snapshots , promotion_result , deployability_index_for_evaluation
158164 )
159165
160- if not plan .requires_backfill :
161- self .console .log_success ("Virtual Update executed successfully" )
162-
163166 execute_environment_statements (
164167 adapter = self .snapshot_evaluator .adapter ,
165168 environment_statements = plan .environment_statements or [],
@@ -187,7 +190,7 @@ def _backfill(
187190 selected_snapshots : t .Set [str ],
188191 deployability_index : DeployabilityIndex ,
189192 circuit_breaker : t .Optional [t .Callable [[], bool ]] = None ,
190- ) -> None :
193+ ) -> CompletionStatus :
191194 """Backfill missing intervals for snapshots that are part of the given plan.
192195
193196 Args:
@@ -212,10 +215,10 @@ def _backfill(
212215 )
213216 )
214217 self .state_sync .add_snapshots_intervals (intervals_to_add )
215- return
218+ return CompletionStatus . NOTHING_TO_DO
216219
217220 if not plan .requires_backfill or not selected_snapshots :
218- return
221+ return CompletionStatus . NOTHING_TO_DO
219222
220223 scheduler = self .create_scheduler (snapshots_by_name .values ())
221224 completion_status = scheduler .run (
@@ -236,6 +239,8 @@ def _backfill(
236239 if completion_status .is_failure :
237240 raise PlanError ("Plan application failed." )
238241
242+ return completion_status
243+
239244 def _push (
240245 self ,
241246 plan : EvaluatablePlan ,
@@ -279,6 +284,7 @@ def _should_create(s: Snapshot) -> bool:
279284 on_start = lambda x : self .console .start_creation_progress (
280285 x , plan .environment , self .default_catalog
281286 ),
287+ on_no_work = self .console .log_status_update ,
282288 on_complete = self .console .update_creation_progress ,
283289 )
284290 completed = True
0 commit comments