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

SDK - Compiler - Fixed failures on Jinja placeholders #2522

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
18 changes: 13 additions & 5 deletions sdk/python/kfp/compiler/_data_passing_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def fix_big_data_passing(workflow: dict) -> dict:
template_input_to_parent_constant_arguments.setdefault((task_template_name, task_input_name), set()).add(argument_value)

placeholder_type = argument_placeholder_parts[0]
if placeholder_type not in ('inputs', 'outputs', 'tasks', 'steps', 'workflow', 'pod', 'item'):
# Do not fail on Jinja or other double-curly-brace templates
continue
if placeholder_type == 'inputs':
assert argument_placeholder_parts[1] == 'parameters'
dag_input_name = argument_placeholder_parts[2]
Expand Down Expand Up @@ -135,6 +138,9 @@ def fix_big_data_passing(workflow: dict) -> dict:
for placeholder in placeholders:
parts = placeholder.split('.')
placeholder_type = parts[0]
if placeholder_type not in ('inputs', 'outputs', 'tasks', 'steps', 'workflow', 'pod', 'item'):
# Do not fail on Jinja or other double-curly-brace templates
continue
if placeholder_type == 'inputs':
if parts[1] == 'parameters':
input_name = parts[2]
Expand Down Expand Up @@ -162,20 +168,22 @@ def fix_big_data_passing(workflow: dict) -> dict:
for placeholder in placeholders:
parts = placeholder.split('.')
placeholder_type = parts[0]
if placeholder_type not in ('inputs', 'outputs', 'tasks', 'steps', 'workflow', 'pod', 'item'):
# Do not fail on Jinja or other double-curly-brace templates
continue

if placeholder_type == 'workflow' or placeholder_type == 'pod':
pass
elif placeholder_type == 'inputs':
if parts[1] == 'parameters':
input_name = parts[2]
inputs_directly_consumed_as_parameters.add((template_name, input_name))
elif parts[1] == 'artifacts':
raise AssertionError # Should not happen in container templates
raise AssertionError('Found unexpected Argo input artifact placeholder in container template: {}'.format(placeholder))
else:
raise AssertionError
elif placeholder_type == 'outputs':
raise AssertionError # Should not happen in container templates
raise AssertionError('Found unexpected Argo input placeholder in container template: {}'.format(placeholder))
else:
raise AssertionError
raise AssertionError('Found unexpected Argo placeholder in container template: {}'.format(placeholder))

# Finished indexing data consumers

Expand Down