Skip to content

Commit ec659e4

Browse files
committed
Fix virtual layer prog bar label
1 parent 2d8db29 commit ec659e4

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

sqlmesh/core/console.py

+13-18
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,13 @@ def show_linter_violations(
516516
pass
517517

518518

519-
def make_progress_bar(message: str, console: t.Optional[RichConsole] = None) -> Progress:
519+
def make_progress_bar(
520+
message: str,
521+
console: t.Optional[RichConsole] = None,
522+
justify: t.Literal["default", "left", "center", "right", "full"] = "right",
523+
) -> Progress:
520524
return Progress(
521-
TextColumn(f"[bold blue]{message}", justify="right"),
525+
TextColumn(f"[bold blue]{message}", justify=justify),
522526
BarColumn(bar_width=PROGRESS_BAR_WIDTH),
523527
"[progress.percentage]{task.percentage:>3.1f}%",
524528
"•",
@@ -696,7 +700,7 @@ def update_snapshot_evaluation_progress(
696700
)
697701

698702
self.evaluation_progress_live.console.print(
699-
f"{GREEN_CHECK_MARK} {batch}{display_name}{annotation} {duration}"
703+
f"{batch}{display_name}{annotation} {duration}"
700704
)
701705

702706
self.evaluation_total_progress.update(
@@ -749,7 +753,7 @@ def update_creation_progress(self, snapshot: SnapshotInfoLike) -> None:
749753
if self.creation_progress is not None and self.creation_task is not None:
750754
if self.verbosity >= Verbosity.VERBOSE:
751755
self.creation_progress.live.console.print(
752-
f"{GREEN_CHECK_MARK} {snapshot.display_name(self.environment_naming_info, self.default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect).ljust(self.PROGRESS_BAR_COLUMN_WIDTHS['name'])} [green]created[/green]"
756+
f"{snapshot.display_name(self.environment_naming_info, self.default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect).ljust(self.PROGRESS_BAR_COLUMN_WIDTHS['name'])} [green]created[/green]"
753757
)
754758
self.creation_progress.update(self.creation_task, refresh=True, advance=1)
755759

@@ -799,16 +803,8 @@ def start_promotion_progress(
799803
) -> None:
800804
"""Indicates that a new snapshot promotion progress has begun."""
801805
if self.promotion_progress is None:
802-
self.promotion_progress = Progress(
803-
TextColumn(
804-
"[bold blue]Updating virtual layer ", # space to align with other progress bars
805-
justify="right",
806-
),
807-
BarColumn(bar_width=PROGRESS_BAR_WIDTH),
808-
"[progress.percentage]{task.percentage:>3.1f}%",
809-
"•",
810-
TimeElapsedColumn(),
811-
console=self.console,
806+
self.promotion_progress = make_progress_bar(
807+
"Updating virtual layer ", self.console, justify="left"
812808
)
813809

814810
self.promotion_progress.start()
@@ -824,10 +820,9 @@ def update_promotion_progress(self, snapshot: SnapshotInfoLike, promoted: bool)
824820
"""Update the snapshot promotion progress."""
825821
if self.promotion_progress is not None and self.promotion_task is not None:
826822
if self.verbosity >= Verbosity.VERBOSE:
827-
check_mark = f"{GREEN_CHECK_MARK} " if promoted else " "
828823
action_str = "[green]promoted[/green]" if promoted else "[yellow]demoted[/yellow]"
829824
self.promotion_progress.live.console.print(
830-
f"{check_mark}{snapshot.display_name(self.environment_naming_info, self.default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect).ljust(self.PROGRESS_BAR_COLUMN_WIDTHS['name'])} {action_str}"
825+
f"{snapshot.display_name(self.environment_naming_info, self.default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect).ljust(self.PROGRESS_BAR_COLUMN_WIDTHS['name'])} {action_str}"
831826
)
832827
self.promotion_progress.update(self.promotion_task, refresh=True, advance=1)
833828

@@ -2759,8 +2754,8 @@ def _format_evaluation_model_interval(snapshot: Snapshot, interval: Interval) ->
27592754
def _justify_evaluation_model_info(
27602755
text: str,
27612756
length: int,
2762-
justify_direction: str = "left",
2763-
dots_side: str = "left",
2757+
justify_direction: t.Literal["left", "right"] = "left",
2758+
dots_side: t.Literal["left", "right"] = "left",
27642759
prefix: str = "",
27652760
suffix: str = "",
27662761
) -> str:

sqlmesh/core/scheduler.py

-2
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,6 @@ def evaluate_node(node: SchedulingUnit) -> None:
478478
execution_time=execution_time,
479479
deployability_index=deployability_index,
480480
batch_index=batch_idx,
481-
environment_naming_info=environment_naming_info,
482-
default_catalog=self.default_catalog,
483481
)
484482

485483
for audit_error in audit_errors_to_warn:

0 commit comments

Comments
 (0)