Skip to content

Commit 00143b5

Browse files
authored
Chore: condense completion messages (#3563)
1 parent 41a7b4d commit 00143b5

File tree

6 files changed

+69
-68
lines changed

6 files changed

+69
-68
lines changed

sqlmesh/core/console.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def stop_evaluation_progress(self, success: bool = True) -> None:
411411
if self.evaluation_progress_live:
412412
self.evaluation_progress_live.stop()
413413
if success:
414-
self.log_success("All model batches have been executed successfully")
414+
self.log_success("Model batches executed successfully")
415415

416416
self.evaluation_progress_live = None
417417
self.evaluation_total_progress = None
@@ -458,7 +458,7 @@ def stop_creation_progress(self, success: bool = True) -> None:
458458
self.creation_progress.stop()
459459
self.creation_progress = None
460460
if success:
461-
self.log_success("All model versions have been created successfully")
461+
self.log_success("Model versions created successfully")
462462

463463
self.environment_naming_info = EnvironmentNamingInfo()
464464
self.default_catalog = None
@@ -535,7 +535,7 @@ def stop_promotion_progress(self, success: bool = True) -> None:
535535
self.promotion_progress.stop()
536536
self.promotion_progress = None
537537
if success:
538-
self.log_success("The target environment has been updated successfully")
538+
self.log_success("Target environment updated successfully")
539539

540540
self.environment_naming_info = EnvironmentNamingInfo()
541541
self.default_catalog = None
@@ -561,15 +561,15 @@ def log_migration_status(self, success: bool = True) -> None:
561561
if self.migration_progress is not None:
562562
self.migration_progress = None
563563
if success:
564-
self.log_success("The migration has been completed successfully")
564+
self.log_success("Migration completed successfully")
565565

566566
def stop_snapshot_migration_progress(self, success: bool = True) -> None:
567567
"""Stop the migration progress."""
568568
self.migration_task = None
569569
if self.migration_progress is not None:
570570
self.migration_progress.stop()
571571
if success:
572-
self.log_success("All snapshots have been migrated successfully")
572+
self.log_success("Snapshots migrated successfully")
573573

574574
def start_env_migration_progress(self, total_tasks: int) -> None:
575575
"""Indicates that a new environment migration has begun."""
@@ -595,7 +595,7 @@ def stop_env_migration_progress(self, success: bool = True) -> None:
595595
self.env_migration_progress.stop()
596596
self.env_migration_progress = None
597597
if success:
598-
self.log_success("All environments have been migrated successfully")
598+
self.log_success("Environments migrated successfully")
599599

600600
def show_model_difference_summary(
601601
self,

sqlmesh/core/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def _has_environment_changed() -> bool:
699699
done = True
700700
except CircuitBreakerError:
701701
logger.warning(
702-
"Environment '%s' has been modified while running. Restarting the run...",
702+
"Environment '%s' modified while running. Restarting the run...",
703703
environment,
704704
)
705705
if exit_on_env_update:
@@ -1404,9 +1404,9 @@ def invalidate_environment(self, name: str, sync: bool = False) -> None:
14041404
self.state_sync.invalidate_environment(name)
14051405
if sync:
14061406
self._cleanup_environments()
1407-
self.console.log_success(f"Environment '{name}' has been deleted.")
1407+
self.console.log_success(f"Environment '{name}' deleted.")
14081408
else:
1409-
self.console.log_success(f"Environment '{name}' has been invalidated.")
1409+
self.console.log_success(f"Environment '{name}' invalidated.")
14101410

14111411
@python_api_analytics
14121412
def diff(self, environment: t.Optional[str] = None, detailed: bool = False) -> bool:

sqlmesh/core/plan/evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def evaluate(
469469
if not plan_application_succeeded:
470470
raise PlanError("Plan application failed.")
471471

472-
self.console.log_success("The plan has been applied successfully")
472+
self.console.log_success("Plan applied successfully")
473473

474474
@property
475475
def client(self) -> BaseAirflowClient:

sqlmesh/utils/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class UnsupportedCatalogOperationError(EngineAdapterError):
152152

153153
class CircuitBreakerError(SQLMeshError):
154154
def __init__(self) -> None:
155-
super().__init__("Circuit breaker has been triggered.")
155+
super().__init__("Circuit breaker triggered.")
156156

157157

158158
def raise_config_error(

tests/cli/test_cli.py

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ def assert_new_env(result, new_env="prod", from_env="prod", initialize=True) ->
128128

129129

130130
def assert_model_versions_created(result) -> None:
131-
assert "All model versions have been created successfully" in result.output
131+
assert "Model versions created successfully" in result.output
132132

133133

134134
def assert_model_batches_executed(result) -> None:
135-
assert "All model batches have been executed successfully" in result.output
135+
assert "Model batches executed successfully" in result.output
136136

137137

138138
def assert_target_env_updated(result) -> None:
139-
assert "The target environment has been updated successfully" in result.output
139+
assert "Target environment updated successfully" in result.output
140140

141141

142142
def assert_backfill_success(result) -> None:
@@ -244,7 +244,7 @@ def test_plan_skip_backfill(runner, tmp_path, flag):
244244
)
245245
assert result.exit_code == 0
246246
assert_virtual_update(result)
247-
assert "All model batches have been executed successfully" not in result.output
247+
assert "Model batches executed successfully" not in result.output
248248

249249

250250
def test_plan_auto_apply(runner, tmp_path):
@@ -450,8 +450,8 @@ def test_plan_dev_no_prompts(runner, tmp_path):
450450
cli, ["--log-file-dir", tmp_path, "--paths", tmp_path, "plan", "dev", "--no-prompts"]
451451
)
452452
assert "Apply - Backfill Tables [y/n]: " in result.output
453-
assert "All model versions have been created successfully" not in result.output
454-
assert "All model batches have been executed successfully" not in result.output
453+
assert "Model versions created successfully" not in result.output
454+
assert "Model batches executed successfully" not in result.output
455455
assert "The target environment has been updated successfully" not in result.output
456456

457457

@@ -896,50 +896,51 @@ def test_plan_dlt(runner, tmp_path):
896896
assert incremental_model == expected_incremental_model
897897
assert nested_model == expected_nested_fillings_model
898898

899-
# Plan prod and backfill
900-
result = runner.invoke(
901-
cli, ["--log-file-dir", tmp_path, "--paths", tmp_path, "plan", "--auto-apply"]
902-
)
903-
904-
assert result.exit_code == 0
905-
assert_backfill_success(result)
906-
907-
# Remove and update with missing model
908-
remove(dlt_waiters_model_path)
909-
assert not dlt_waiters_model_path.exists()
910-
911-
# Update with force = False will generate only the missing model
912-
context = Context(paths=tmp_path)
913-
assert generate_dlt_models(context, "sushi", [], False) == [
914-
"sushi_dataset_sqlmesh.incremental_waiters"
915-
]
916-
assert dlt_waiters_model_path.exists()
917-
918-
# Remove all models
919-
remove(dlt_waiters_model_path)
920-
remove(dlt_loads_model_path)
921-
remove(dlt_sushi_types_model_path)
922-
remove(dlt_sushi_fillings_model_path)
923-
remove(dlt_sushi_twice_nested_model_path)
924-
925-
# Update to generate a specific model: sushi_types
926-
assert generate_dlt_models(context, "sushi", ["sushi_types"], False) == [
927-
"sushi_dataset_sqlmesh.incremental_sushi_types"
928-
]
929-
930-
# Only the sushi_types should be generated now
931-
assert not dlt_waiters_model_path.exists()
932-
assert not dlt_loads_model_path.exists()
933-
assert not dlt_sushi_fillings_model_path.exists()
934-
assert not dlt_sushi_twice_nested_model_path.exists()
935-
assert dlt_sushi_types_model_path.exists()
936-
937-
# Update with force = True will generate all models and overwrite existing ones
938-
generate_dlt_models(context, "sushi", [], True)
939-
assert dlt_loads_model_path.exists()
940-
assert dlt_sushi_types_model_path.exists()
941-
assert dlt_waiters_model_path.exists()
942-
assert dlt_sushi_fillings_model_path.exists()
943-
assert dlt_sushi_twice_nested_model_path.exists()
899+
try:
900+
# Plan prod and backfill
901+
result = runner.invoke(
902+
cli, ["--log-file-dir", tmp_path, "--paths", tmp_path, "plan", "--auto-apply"]
903+
)
944904

945-
remove(dataset_path)
905+
assert result.exit_code == 0
906+
assert_backfill_success(result)
907+
908+
# Remove and update with missing model
909+
remove(dlt_waiters_model_path)
910+
assert not dlt_waiters_model_path.exists()
911+
912+
# Update with force = False will generate only the missing model
913+
context = Context(paths=tmp_path)
914+
assert generate_dlt_models(context, "sushi", [], False) == [
915+
"sushi_dataset_sqlmesh.incremental_waiters"
916+
]
917+
assert dlt_waiters_model_path.exists()
918+
919+
# Remove all models
920+
remove(dlt_waiters_model_path)
921+
remove(dlt_loads_model_path)
922+
remove(dlt_sushi_types_model_path)
923+
remove(dlt_sushi_fillings_model_path)
924+
remove(dlt_sushi_twice_nested_model_path)
925+
926+
# Update to generate a specific model: sushi_types
927+
assert generate_dlt_models(context, "sushi", ["sushi_types"], False) == [
928+
"sushi_dataset_sqlmesh.incremental_sushi_types"
929+
]
930+
931+
# Only the sushi_types should be generated now
932+
assert not dlt_waiters_model_path.exists()
933+
assert not dlt_loads_model_path.exists()
934+
assert not dlt_sushi_fillings_model_path.exists()
935+
assert not dlt_sushi_twice_nested_model_path.exists()
936+
assert dlt_sushi_types_model_path.exists()
937+
938+
# Update with force = True will generate all models and overwrite existing ones
939+
generate_dlt_models(context, "sushi", [], True)
940+
assert dlt_loads_model_path.exists()
941+
assert dlt_sushi_types_model_path.exists()
942+
assert dlt_waiters_model_path.exists()
943+
assert dlt_sushi_fillings_model_path.exists()
944+
assert dlt_sushi_twice_nested_model_path.exists()
945+
finally:
946+
remove(dataset_path)

tests/integrations/jupyter/test_magics.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def test_plan(
303303
)
304304
# TODO: Is this what we expect?
305305
assert text_output[2] == ""
306-
assert text_output[3] == "The target environment has been updated successfully"
306+
assert text_output[3] == "Target environment updated successfully"
307307
assert convert_all_html_output_to_tags(output) == [
308308
["pre", "span"],
309309
["pre"] + ["span"] * 4,
@@ -326,7 +326,7 @@ def test_run_dag(
326326
assert not output.stderr
327327
assert len(output.outputs) == 2
328328
assert convert_all_html_output_to_text(output) == [
329-
"All model batches have been executed successfully",
329+
"Model batches executed successfully",
330330
"Run finished for environment 'prod'",
331331
]
332332
assert get_all_html_output(output) == [
@@ -337,7 +337,7 @@ def test_run_dag(
337337
h(
338338
"span",
339339
{"style": SUCCESS_STYLE},
340-
"All model batches have been executed successfully",
340+
"Model batches executed successfully",
341341
autoescape=False,
342342
),
343343
autoescape=False,
@@ -381,7 +381,7 @@ def test_invalidate(
381381
assert not output.stderr
382382
assert len(output.outputs) == 1
383383
assert convert_all_html_output_to_text(output) == [
384-
"Environment 'dev' has been invalidated.",
384+
"Environment 'dev' invalidated.",
385385
]
386386
assert get_all_html_output(output) == [
387387
str(
@@ -408,7 +408,7 @@ def test_invalidate(
408408
h(
409409
"span",
410410
{"style": SUCCESS_STYLE},
411-
" has been invalidated.",
411+
" invalidated.",
412412
autoescape=False,
413413
)
414414
),

0 commit comments

Comments
 (0)