Skip to content

Commit

Permalink
fix other bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 committed Sep 5, 2024
1 parent f4201bd commit 583bdf7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions metadata-ingestion/src/datahub/cli/ingest_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,18 @@ async def run_pipeline_to_completion(pipeline: Pipeline) -> int:
raw_pipeline_config = pipeline_config.pop("__raw_config")

if test_source_connection:
_test_source_connection(report_to, pipeline_config)
sys.exit(_test_source_connection(report_to, pipeline_config))

if no_default_report:
# The default is "datahub" reporting. The extra flag will disable it.
report_to = None

async def run_ingestion_and_check_upgrade() -> int:
# TRICKY: We want to make sure that the Pipeline.create() call happens on the
# same thread as the rest of the ingestion. As such, we must initialize the
# pipeline inside the async function so that it happens on the same event
# loop, and hence the same thread.

if no_default_report:
# The default is "datahub" reporting. The extra flag will disable it.
report_to = None

# logger.debug(f"Using config: {pipeline_config}")
pipeline = Pipeline.create(
pipeline_config,
Expand Down Expand Up @@ -395,7 +395,7 @@ def deploy(
click.echo(response)


def _test_source_connection(report_to: Optional[str], pipeline_config: dict) -> None:
def _test_source_connection(report_to: Optional[str], pipeline_config: dict) -> int:
connection_report = None
try:
connection_report = ConnectionManager().test_source_connection(pipeline_config)
Expand All @@ -404,12 +404,12 @@ def _test_source_connection(report_to: Optional[str], pipeline_config: dict) ->
with open(report_to, "w") as out_fp:
out_fp.write(connection_report.as_json())
logger.info(f"Wrote report successfully to {report_to}")
sys.exit(0)
return 0
except Exception as e:
logger.error(f"Failed to test connection due to {e}")
if connection_report:
logger.error(connection_report.as_json())
sys.exit(1)
return 1


def parse_restli_response(response):
Expand Down

0 comments on commit 583bdf7

Please sign in to comment.