Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix quoting issue with argo #1456

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,16 @@ def _process_triggers(self):
# Assign a sanitized name since we need this at many places to please
# Argo Events sensors. There is a slight possibility of name collision
# but quite unlikely for us to worry about at this point.
event["sanitized_name"] = event["name"]
if any([x in event["name"] for x in [".", "-", "@", "+"]]):
event["sanitized_name"] = "%s_%s" % (
event["name"]
.replace(".", "")
.replace("-", "")
.replace("@", "")
.replace("+", ""),
to_unicode(
base64.b32encode(sha1(to_bytes(event["name"])).digest())
)[:4].lower(),
)
event["sanitized_name"] = "%s_%s" % (
event["name"]
.replace(".", "")
.replace("-", "")
.replace("@", "")
.replace("+", ""),
to_unicode(base64.b32encode(sha1(to_bytes(event["name"])).digest()))[
:4
].lower(),
)
return triggers, options

def _compile_workflow_template(self):
Expand Down Expand Up @@ -938,10 +936,8 @@ def _container_templates(self):
]
+ [
# Parameter names can be hyphenated, hence we use
# {{foo.bar['param_name']}}. We quote the value to
# make sure whitespaces are properly handled since
# Argo Events wouldn't do that for us.
"--%s='{{workflow.parameters.%s}}'"
# {{foo.bar['param_name']}}.
"--%s={{workflow.parameters.%s}}"
% (parameter["name"], parameter["name"])
for parameter in self.parameters.values()
]
Expand Down Expand Up @@ -1274,12 +1270,13 @@ def _container_templates(self):
+ ARGO_WORKFLOWS_KUBERNETES_SECRETS.split(",")
if k
],
# Assign a volume point to pass state to the next task.
volume_mounts=[
# Assign a volume mount to pass state to the next task.
kubernetes_sdk.V1VolumeMount(
name="out", mount_path="/mnt/out"
)
]
# Support tmpfs.
+ (
[
kubernetes_sdk.V1VolumeMount(
Expand All @@ -1290,6 +1287,7 @@ def _container_templates(self):
if tmpfs_enabled
else []
)
# Support persistent volume claims.
+ (
[
kubernetes_sdk.V1VolumeMount(
Expand Down