Skip to content
Merged
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
17 changes: 16 additions & 1 deletion lando_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def post_actions(


def wait_for_job_completion(
config: Config, job_id: int, poll_interval: int = 3
config: Config,
job_id: int,
poll_interval: int = 3,
) -> dict:
"""Wait for a job to complete."""
click.echo("Waiting for job completion, you may exit at any time.")
Expand All @@ -158,6 +160,8 @@ def wait_for_job_completion(
+ "to check the status later."
)

previous_status = None

while True:
result = get_job_status(config, job_id)

Expand All @@ -167,6 +171,15 @@ def wait_for_job_completion(
click.echo("Job has been submitted and will be started soon.")
elif status == "IN_PROGRESS":
click.echo("Job is in progress.")
elif status == "DEFERRED":
if previous_status != "DEFERRED":
error_details = result.get("error", "No additional details provided.")
click.secho(
f"Job {job_id} was deferred, and will be retried.", fg="yellow"
)
click.echo(error_details)
else:
click.echo("Job was deferred and will be retried.")
elif status == "FAILED":
error_details = result.get("error", "No additional details provided.")
click.secho(f"Job {job_id} failed!", fg="red", bold=True)
Expand All @@ -187,6 +200,8 @@ def wait_for_job_completion(

time.sleep(poll_interval)

previous_status = status

return result


Expand Down