Skip to content

Commit e315d23

Browse files
committed
Return completion status from _push
1 parent d56d94b commit e315d23

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

sqlmesh/core/plan/evaluator.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ def evaluate(
134134
execution_time=plan.execution_time,
135135
)
136136

137-
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+
)
138142
update_intervals_for_new_snapshots(plan.new_snapshots, self.state_sync)
139143
self._restate(plan, snapshots_by_name)
140144
first_bf_completion_status = self._backfill(
@@ -246,7 +250,7 @@ def _push(
246250
plan: EvaluatablePlan,
247251
snapshots: t.Dict[SnapshotId, Snapshot],
248252
deployability_index: t.Optional[DeployabilityIndex] = None,
249-
) -> None:
253+
) -> CompletionStatus:
250254
"""Push the snapshots to the state sync.
251255
252256
As a part of plan pushing, snapshot tables are created.
@@ -273,7 +277,7 @@ def _should_create(s: Snapshot) -> bool:
273277

274278
snapshots_to_create = [s for s in snapshots.values() if _should_create(s)]
275279

276-
completed = False
280+
completion_status = None
277281
progress_stopped = False
278282
try:
279283
completion_status = self.snapshot_evaluator.create(
@@ -286,11 +290,6 @@ def _should_create(s: Snapshot) -> bool:
286290
),
287291
on_complete=self.console.update_creation_progress,
288292
)
289-
if completion_status.is_nothing_to_do:
290-
self.console.log_status_update(
291-
"\n[green]SKIP: No physical layer updates to perform[/green]\n"
292-
)
293-
completed = True
294293
except NodeExecutionFailedError as ex:
295294
self.console.stop_creation_progress(success=False)
296295
progress_stopped = True
@@ -301,13 +300,16 @@ def _should_create(s: Snapshot) -> bool:
301300
raise PlanError("Plan application failed.")
302301
finally:
303302
if not progress_stopped:
304-
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+
)
305306

306307
self.state_sync.push_snapshots(plan.new_snapshots)
307308

308309
analytics.collector.on_snapshots_created(
309310
new_snapshots=plan.new_snapshots, plan_id=plan.plan_id
310311
)
312+
return completion_status
311313

312314
def _promote(
313315
self,

0 commit comments

Comments
 (0)