Skip to content

Commit 35a3ba7

Browse files
author
Nissan Pow
committed
fix: use bash parameter expansion for SFN resume CLI opts
The $(if ...) construct with double-quoted variables caused shlex.split in batch.py's _command() to split the bash -c string incorrectly, breaking all SFN deployer runs. Switch to ${VAR:+...} parameter expansion (matching the Argo implementation) to avoid quoting issues.
1 parent 1820867 commit 35a3ba7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

metaflow/plugins/aws/step_functions/step_functions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,18 @@ def _step_cli(self, node, paths, code_package_url, user_code_retries):
10641064
step.extend("--tag %s" % tag for tag in self.tags)
10651065
if self.namespace is not None:
10661066
step.append("--namespace=%s" % self.namespace)
1067-
cmds.append(" ".join(entrypoint + top_level + step))
1067+
# Build the step command, then append resume options that are only
1068+
# included when the env vars are non-empty (normal triggers set them
1069+
# to empty strings). We use bash parameter expansion ${VAR:+...}
1070+
# instead of $(if ...) to avoid double-quote issues with shlex.split
1071+
# in batch.py's _command().
1072+
step_cmd = " ".join(entrypoint + top_level + step)
1073+
resume_opts = (
1074+
"${METAFLOW_RESUME_ORIGIN_RUN_ID:+"
1075+
"--resume-origin-run-id $METAFLOW_RESUME_ORIGIN_RUN_ID "
1076+
"--resume-steps-to-rerun $METAFLOW_RESUME_STEPS_TO_RERUN}"
1077+
)
1078+
cmds.append("%s %s" % (step_cmd, resume_opts))
10681079
return " && ".join(cmds)
10691080

10701081

0 commit comments

Comments
 (0)