Skip to content

Commit

Permalink
Mirror default card option on execution
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudw committed Sep 26, 2024
1 parent b69a047 commit 8dd2a63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions metaflow/plugins/aip/aip.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def __init__(
notify_on_success=None,
sqs_url_on_error=None,
sqs_role_arn_on_error=None,
add_default_cards=False,
**kwargs,
):
"""
Expand Down Expand Up @@ -204,6 +205,7 @@ def __init__(
self.notify_on_success = notify_on_success
self.sqs_url_on_error = sqs_url_on_error
self.sqs_role_arn_on_error = sqs_role_arn_on_error
self.add_default_cards = add_default_cards
self._client = None
self._exit_handler_created = False

Expand Down Expand Up @@ -1449,6 +1451,8 @@ def _create_metaflow_step_op(
metaflow_execution_cmd += " --is_split_index"
if node.type == "join":
metaflow_execution_cmd += " --is-join-step"
if self.add_default_cards:
metaflow_execution_cmd += " --add-default-cards"

metaflow_execution_cmd += ' --preceding_component_outputs_dict "'
for key in preceding_component_outputs_dict:
Expand Down
1 change: 1 addition & 0 deletions metaflow/plugins/aip/aip_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,5 @@ def make_flow(
notify_on_success=notify_on_success,
sqs_url_on_error=sqs_url_on_error,
sqs_role_arn_on_error=sqs_role_arn_on_error,
add_default_cards=add_default_cards,
)
5 changes: 5 additions & 0 deletions metaflow/plugins/aip/aip_metaflow_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _step_cli(
max_user_code_retries: int,
workflow_name: str,
script_name: str,
add_default_card: bool,
) -> str:
"""
Analogous to step_functions.py
Expand Down Expand Up @@ -166,6 +167,7 @@ def _step_cli(

step: List[str] = [
"--with=aip",
"--with 'card:id=default'" if add_default_card else "",
"step",
step_name,
"--run-id %s" % run_id,
Expand Down Expand Up @@ -275,6 +277,7 @@ def _command(
@click.option("--workflow_name")
@click.option("--is-interruptible/--not-interruptible", default=False)
@click.option("--is-join-step", is_flag=True, default=False)
@click.option("--add-default-cards", is_flag=True, default=False)
def aip_metaflow_step(
volume_dir: str,
environment: str,
Expand All @@ -300,6 +303,7 @@ def aip_metaflow_step(
workflow_name: str,
is_interruptible: bool,
is_join_step: bool,
add_default_cards: bool,
) -> None:
"""
(1) Renders and runs the Metaflow package_commands and Metaflow step
Expand Down Expand Up @@ -331,6 +335,7 @@ def aip_metaflow_step(
user_code_retries,
workflow_name,
script_name,
add_default_cards,
)

# expose passed KFP passed in arguments as environment variables to
Expand Down

0 comments on commit 8dd2a63

Please sign in to comment.