Skip to content

Commit

Permalink
Adds support for wait for execution with a configurable interval (#2913)
Browse files Browse the repository at this point in the history
* Adds support for wait for execution with a configurable interval

Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>

* lint

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>

---------

Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Co-authored-by: Ketan Umare <kumare3@users.noreply.github.com>
Co-authored-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent 55e9f8d commit 51f9a3e
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions flytekit/clis/sdk_in_container/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,24 @@ class RunLevelParams(PyFlyteParams):
)
wait_execution: bool = make_click_option_field(
click.Option(
param_decls=["--wait-execution", "wait_execution"],
param_decls=["--wait", "--wait-execution", "wait_execution"],
required=False,
is_flag=True,
default=False,
show_default=True,
help="Whether to wait for the execution to finish",
)
)
poll_interval: int = make_click_option_field(
click.Option(
param_decls=["-i", "--poll-interval", "poll_interval"],
required=False,
type=int,
default=None,
show_default=True,
help="Poll interval in seconds to check the status of the execution",
)
)
dump_snippet: bool = make_click_option_field(
click.Option(
param_decls=["--dump-snippet", "dump_snippet"],
Expand Down Expand Up @@ -532,7 +542,6 @@ def run_remote(
project=project,
domain=domain,
execution_name=run_level_params.name,
wait=run_level_params.wait_execution,
options=options_from_run_params(run_level_params),
type_hints=type_hints,
overwrite_cache=run_level_params.overwrite_cache,
Expand All @@ -541,15 +550,16 @@ def run_remote(
cluster_pool=run_level_params.cluster_pool,
execution_cluster_label=run_level_params.execution_cluster_label,
)
s = (
click.style("\n[✔] ", fg="green")
+ "Go to "
+ click.style(execution.execution_url, fg="cyan")
+ " to see execution in the console."
)
click.echo(s)

console_url = remote.generate_console_url(execution)
s = (
click.style("\n[✔] ", fg="green")
+ "Go to "
+ click.style(console_url, fg="cyan")
+ " to see execution in the console."
)
click.echo(s)
if run_level_params.wait_execution:
execution = remote.wait(execution, poll_interval=run_level_params.poll_interval)

if run_level_params.wait_execution:
if execution.closure.phase != WorkflowExecutionPhase.SUCCEEDED:
Expand Down

0 comments on commit 51f9a3e

Please sign in to comment.