Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingest): add ingest --no-progress option #9300

Merged
merged 9 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Command Options:
--preview-workunits The number of workunits to produce for preview
--strict-warnings If enabled, ingestion runs with warnings will yield a non-zero error code
--test-source-connection When set, ingestion will only test the source connection details from the recipe
--no-progress If enabled, mute intermediate progress ingestion reports
```
#### ingest --dry-run

Expand Down
10 changes: 10 additions & 0 deletions metadata-ingestion/src/datahub/cli/ingest_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ def ingest() -> None:
@click.option(
"--no-spinner", type=bool, is_flag=True, default=False, help="Turn off spinner"
)
@click.option(
"--no-progress",
type=bool,
is_flag=True,
default=False,
help="If enabled, mute intermediate progress ingestion reports",
)
@telemetry.with_telemetry(
capture_kwargs=[
"dry_run",
Expand All @@ -105,6 +112,7 @@ def ingest() -> None:
"test_source_connection",
"no_default_report",
"no_spinner",
"no_progress",
]
)
def run(
Expand All @@ -117,6 +125,7 @@ def run(
report_to: str,
no_default_report: bool,
no_spinner: bool,
no_progress: bool,
) -> None:
"""Ingest metadata into DataHub."""

Expand Down Expand Up @@ -170,6 +179,7 @@ async def run_ingestion_and_check_upgrade() -> int:
preview_workunits,
report_to,
no_default_report,
no_progress,
raw_pipeline_config,
)

Expand Down
6 changes: 5 additions & 1 deletion metadata-ingestion/src/datahub/ingestion/run/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,15 @@ def __init__(
preview_workunits: int = 10,
report_to: Optional[str] = None,
no_default_report: bool = False,
no_progress: bool = False,
):
self.config = config
self.dry_run = dry_run
self.preview_mode = preview_mode
self.preview_workunits = preview_workunits
self.report_to = report_to
self.reporters: List[PipelineRunListener] = []
self.no_progress = no_progress
self.num_intermediate_workunits = 0
self.last_time_printed = int(time.time())
self.cli_report = CliReport()
Expand Down Expand Up @@ -330,6 +332,7 @@ def create(
preview_workunits: int = 10,
report_to: Optional[str] = "datahub",
no_default_report: bool = False,
no_progress: bool = False,
raw_config: Optional[dict] = None,
) -> "Pipeline":
config = PipelineConfig.from_dict(config_dict, raw_config)
Expand All @@ -340,6 +343,7 @@ def create(
preview_workunits=preview_workunits,
report_to=report_to,
no_default_report=no_default_report,
no_progress=no_progress,
)

def _time_to_print(self) -> bool:
Expand Down Expand Up @@ -379,7 +383,7 @@ def run(self) -> None:
self.preview_workunits if self.preview_mode else None,
):
try:
if self._time_to_print():
if self._time_to_print() and not self.no_progress:
self.pretty_print_summary(currently_running=True)
except Exception as e:
logger.warning(f"Failed to print summary {e}")
Expand Down
Loading