-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add parameter info to argo workflow template annotations #1549
Changes from 3 commits
b875b12
76723bc
581cc22
a46965a
fae29ad
79d8635
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,6 +401,8 @@ def _process_parameters(self): | |
) | ||
seen.add(norm) | ||
|
||
param_type = str(param.kwargs.get("type").__name__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flatten the type information to a string instead of the |
||
|
||
is_required = param.kwargs.get("required", False) | ||
# Throw an exception if a schedule is set for a flow with required | ||
# parameters with no defaults. We currently don't have any notion | ||
|
@@ -412,16 +414,17 @@ def _process_parameters(self): | |
"Scheduling such parameters via Argo CronWorkflows is not " | ||
"currently supported." % param.name | ||
) | ||
value = deploy_time_eval(param.kwargs.get("default")) | ||
default_value = deploy_time_eval(param.kwargs.get("default")) | ||
# If the value is not required and the value is None, we set the value to | ||
# the JSON equivalent of None to please argo-workflows. Unfortunately it | ||
# has the side effect of casting the parameter value to string null during | ||
# execution - which needs to be fixed imminently. | ||
if not is_required or value is not None: | ||
value = json.dumps(value) | ||
if not is_required or default_value is not None: | ||
default_value = json.dumps(default_value) | ||
parameters[param.name] = dict( | ||
name=param.name, | ||
value=value, | ||
value=default_value, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to rename this in the parameter map too but I didn't want to get too ambitious, especially since it's serialized in the argo workflow template as |
||
type=param_type, | ||
description=param.kwargs.get("help"), | ||
is_required=is_required, | ||
) | ||
|
@@ -574,6 +577,14 @@ def _compile_workflow_template(self): | |
"metaflow/user": "argo-workflows", | ||
"metaflow/flow_name": self.flow.name, | ||
} | ||
|
||
if self.parameters: | ||
annotations.update( | ||
{ | ||
"metaflow/parameters": json.dumps(self.parameters) | ||
} | ||
) | ||
|
||
if current.get("project_name"): | ||
annotations.update( | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to supply the type information in a standardized way across all types. The rest of the types are builtins which already have this field.