Skip to content

Commit

Permalink
fix: remove step level decospecs (Netflix#2203)
Browse files Browse the repository at this point in the history
* Remove step level decospecs

This was not used anywhere and step is an internal command.
Also added clarifying comments around attaching decospecs

---------

Co-authored-by: Romain Cledat <[email protected]>
  • Loading branch information
saikonen and romain-intel authored Jan 11, 2025
1 parent 10bfd16 commit 96f5271
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
5 changes: 5 additions & 0 deletions metaflow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ def start(
# *after* the run decospecs so that they don't take precedence. In other
# words, for the same decorator, we want `myflow.py run --with foo` to
# take precedence over any other `foo` decospec

# Note that top-level decospecs are used primarily with non run/resume
# options as well as with the airflow/argo/sfn integrations which pass
# all the decospecs (the ones from top-level but also the ones from the
# run/resume level) through the tl decospecs.
ctx.obj.tl_decospecs = list(decospecs or [])

# initialize current and parameter context for deploy-time parameters
Expand Down
2 changes: 2 additions & 0 deletions metaflow/cli_components/run_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def before_run(obj, tags, decospecs):
+ list(obj.environment.decospecs() or [])
)
if all_decospecs:
# These decospecs are the ones from run/resume PLUS the ones from the
# environment (for example the @conda)
decorators._attach_decorators(obj.flow, all_decospecs)
decorators._init(obj.flow)
# Regenerate graph if we attached more decorators
Expand Down
13 changes: 0 additions & 13 deletions metaflow/cli_components/step_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@
default=None,
help="Run id of the origin flow, if this task is part of a flow being resumed.",
)
@click.option(
"--with",
"decospecs",
multiple=True,
help="Add a decorator to this task. You can specify this "
"option multiple times to attach multiple decorators "
"to this task.",
)
@click.option(
"--ubf-context",
default="none",
Expand Down Expand Up @@ -112,7 +104,6 @@ def step(
max_user_code_retries=None,
clone_only=None,
clone_run_id=None,
decospecs=None,
ubf_context="none",
num_parallel=None,
):
Expand All @@ -136,10 +127,6 @@ def step(
raise CommandException("Function *%s* is not a step." % step_name)
echo("Executing a step, *%s*" % step_name, fg="magenta", bold=False)

if decospecs:
decorators._attach_decorators_to_step(func, decospecs)
decorators._init(ctx.obj.flow)

step_kwargs = ctx.params
# Remove argument `step_name` from `step_kwargs`.
step_kwargs.pop("step_name", None)
Expand Down

0 comments on commit 96f5271

Please sign in to comment.