Skip to content

Commit 9ed6f0e

Browse files
committed
Fix bugs in --until implementation
Fixed several critical bugs in the resume --until feature: 1. Initialize until_steps to None to prevent NameError when --until is not specified 2. Fix error message to show specific invalid step name instead of entire tuple 3. Remove incorrect clone_only error check that had wrong error message 4. Remove debug print statements 5. Improve comment clarity for step precedence logic Claude helped!
1 parent 5a2801a commit 9ed6f0e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

metaflow/cli_components/run_cmds.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,13 @@ def resume(
232232
if step_to_rerun is None:
233233
steps_to_rerun = set()
234234
else:
235-
if clone_only:
236-
raise CommandException("Cannot specify both --clone-only and --until")
237235
# validate step name
238236
for s in step_to_rerun:
239237
if s not in obj.graph.nodes:
240238
raise CommandException(
241239
"Invalid step name {0} specified, must be step present in "
242240
"current form of execution graph. Valid step names include: {1}".format(
243-
step_to_rerun, ",".join(list(obj.graph.nodes.keys()))
241+
s, ",".join(list(obj.graph.nodes.keys()))
244242
)
245243
)
246244

@@ -261,6 +259,7 @@ def resume(
261259
if clone_only and until is not None:
262260
raise CommandException("Cannot specify both --clone-only and --until")
263261

262+
until_steps = None
264263
if until is not None:
265264
until_steps = set(until.split(","))
266265
for step in until_steps:

metaflow/runtime.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,10 @@ def __init__(
163163
self._steps_no_run.add(next_step)
164164
elif step_name in self._steps_to_rerun:
165165
for next_step in out_funcs:
166-
# We may add things that are in steps_no_run but
167-
# we will remove them later.
168166
self._steps_to_rerun.add(next_step)
167+
# Remove any steps that should not be run (--until takes precedence)
169168
self._steps_to_rerun = self._steps_to_rerun - self._steps_no_run
170169
self._steps_can_clone = all_steps - self._steps_to_rerun - self._steps_no_run
171-
print(f"steps_to_rerun: {self._steps_to_rerun}")
172-
print(f"steps_no_run: {self._steps_no_run}")
173-
print(f"steps_can_clone: {self._steps_can_clone}")
174170

175171
self._origin_ds_set = None
176172
if clone_run_id:

0 commit comments

Comments
 (0)