|
67 | 67 | SnapshotChangeCategory.METADATA: "Metadata", |
68 | 68 | } |
69 | 69 |
|
| 70 | +PROGRESS_BAR_WIDTH = 40 |
| 71 | +LINE_WRAP_WIDTH = 100 |
| 72 | + |
70 | 73 |
|
71 | 74 | class Console(abc.ABC): |
72 | 75 | """Abstract base class for defining classes used for displaying information to the user and also interact |
@@ -463,7 +466,7 @@ def show_row_diff( |
463 | 466 | def make_progress_bar(message: str, console: t.Optional[RichConsole] = None) -> Progress: |
464 | 467 | return Progress( |
465 | 468 | TextColumn(f"[bold blue]{message}", justify="right"), |
466 | | - BarColumn(bar_width=40), |
| 469 | + BarColumn(bar_width=PROGRESS_BAR_WIDTH), |
467 | 470 | "[progress.percentage]{task.percentage:>3.1f}%", |
468 | 471 | "•", |
469 | 472 | srich.BatchColumn(), |
@@ -695,7 +698,7 @@ def start_promotion_progress( |
695 | 698 | f"[bold blue]Virtually Updating '{environment_naming_info.name}'", |
696 | 699 | justify="right", |
697 | 700 | ), |
698 | | - BarColumn(bar_width=40), |
| 701 | + BarColumn(bar_width=PROGRESS_BAR_WIDTH), |
699 | 702 | "[progress.percentage]{task.percentage:>3.1f}%", |
700 | 703 | "•", |
701 | 704 | TimeElapsedColumn(), |
@@ -1241,7 +1244,10 @@ def log_error(self, message: str) -> None: |
1241 | 1244 | def log_warning(self, message: str) -> None: |
1242 | 1245 | logger.warning(message) |
1243 | 1246 | if not self.ignore_warnings: |
1244 | | - self._print(f"[yellow]{message}[/yellow]") |
| 1247 | + message_lstrip = message.lstrip() |
| 1248 | + leading_ws = message[: -len(message_lstrip)] |
| 1249 | + message_formatted = f"{leading_ws}[yellow]\\[WARNING] {message_lstrip}[/yellow]" |
| 1250 | + self._print(message_formatted) |
1245 | 1251 |
|
1246 | 1252 | def log_success(self, message: str) -> None: |
1247 | 1253 | self._print(f"\n[green]{message}[/green]\n") |
@@ -2073,7 +2079,8 @@ def log_error(self, message: str) -> None: |
2073 | 2079 | super().log_error(f"```\n\\[ERROR] {message}```\n\n") |
2074 | 2080 |
|
2075 | 2081 | def log_warning(self, message: str) -> None: |
2076 | | - super().log_warning(f"```\n\\[WARNING] {message}```\n\n") |
| 2082 | + logger.warning(message) |
| 2083 | + self._print(f"```\n\\[WARNING] {message}```\n\n") |
2077 | 2084 |
|
2078 | 2085 |
|
2079 | 2086 | class DatabricksMagicConsole(CaptureTerminalConsole): |
@@ -2499,7 +2506,7 @@ def _format_audits_errors(error: NodeAuditsErrors) -> str: |
2499 | 2506 |
|
2500 | 2507 | err_msg = f"'{err.audit_name}' audit error: {err.count} {'row' if err.count == 1 else 'rows'} failed" |
2501 | 2508 |
|
2502 | | - query = "\n ".join(textwrap.wrap(err.sql(err.adapter_dialect), width=100)) |
| 2509 | + query = "\n ".join(textwrap.wrap(err.sql(err.adapter_dialect), width=LINE_WRAP_WIDTH)) |
2503 | 2510 | msg = f"{err_msg}\n\nAudit arguments\n {audit_args_sql_msg}Audit query\n {query}\n\n" |
2504 | 2511 | msg = msg.replace("\n", "\n ") |
2505 | 2512 | error_messages.append(msg) |
|
0 commit comments