Skip to content

Commit

Permalink
[Run] Write meaningful logs when waiting for pipeline to finish (#3631)
Browse files Browse the repository at this point in the history
  • Loading branch information
liranbg committed May 29, 2023
1 parent 5e6d709 commit c491625
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions mlrun/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,30 +1141,32 @@ def wait_for_pipeline_completion(
if remote:
mldb = mlrun.db.get_run_db()

def get_pipeline_if_completed(run_id, namespace=namespace):
resp = mldb.get_pipeline(run_id, namespace=namespace, project=project)
status = resp["run"]["status"]
show_kfp_run(resp, clear_output=True)
if status not in RunStatuses.stable_statuses():
# TODO: think of nicer liveness indication and make it re-usable
# log '.' each retry as a liveness indication
logger.debug(".")
def _wait_for_pipeline_completion():
pipeline = mldb.get_pipeline(run_id, namespace=namespace, project=project)
pipeline_status = pipeline["run"]["status"]
show_kfp_run(pipeline, clear_output=True)
if pipeline_status not in RunStatuses.stable_statuses():
logger.debug(
"Waiting for pipeline completion",
run_id=run_id,
status=pipeline_status,
)
raise RuntimeError("pipeline run has not completed yet")

return resp
return pipeline

if mldb.kind != "http":
raise ValueError(
"get pipeline require access to remote api-service"
", please set the dbpath url"
"get pipeline requires access to remote api-service"
", set the dbpath url"
)

resp = retry_until_successful(
10,
timeout,
logger,
False,
get_pipeline_if_completed,
_wait_for_pipeline_completion,
run_id,
namespace=namespace,
)
Expand Down

0 comments on commit c491625

Please sign in to comment.