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

No input mapping fix for dag flows #3377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def apply_inputs_mapping(
),
invalid_relations=invalid_relations,
)

# if no input mapping is provided, return the original inputs which is data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not a good idea to add such fallback logic in the "apply_inputs_mapping" function, it should know nothing about the special key "data". If we want to do something special for "data", we'd better handle it outside the utils, where the specific scenario uses it.

if not result:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more PR description on what's the case fixed in this PR?

result = inputs.get("data", {})

# For PRS scenario, apply_inputs_mapping will be used for exec_line and line_number is not necessary.
if LINE_NUMBER_KEY in inputs:
result[LINE_NUMBER_KEY] = inputs[LINE_NUMBER_KEY]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ def test_resolve_data_from_input_path_with_large_data(self, data_path):
"deployment_name": "text-davinci-003",
},
),
(
{
# If input mapping is empty dict, return the original data.
"data": {"question": "Shorter input key has higher priority."},
"line_number": 0,
},
{},
{
"question": "Shorter input key has higher priority.",
"line_number": 0
},
),
],
)
def test_apply_inputs_mapping(self, inputs, inputs_mapping, expected):
Expand Down
Loading