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

[WIP][Flytekit] Add variable_map in LiteralResolver for FlyteRemote.get Error on Dataclass/Pydantic Models #3031

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 4 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
5 changes: 4 additions & 1 deletion flytekit/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,11 @@ def get(
data_response = self.client.get_data(flyte_uri)

if data_response.HasField("literal_map"):
from flytekit.models.interface import VariableMap

lm = LiteralMap.from_flyte_idl(data_response.literal_map)
return LiteralsResolver(lm.literals)
vm = VariableMap.from_flyte_idl(data_response.variable_map)
return LiteralsResolver(lm.literals, vm.variables)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding null check for variable_map

Consider adding null check for data_response.variable_map before accessing it. The variable_map field might be optional and accessing it without validation could cause issues.

Code suggestion
Check the AI-generated fix before applying
Suggested change
vm = VariableMap.from_flyte_idl(data_response.variable_map)
return LiteralsResolver(lm.literals, vm.variables)
variables = {}
if data_response.HasField("variable_map"):
vm = VariableMap.from_flyte_idl(data_response.variable_map)
variables = vm.variables
return LiteralsResolver(lm.literals, variables)

Code Review Run #6ace01


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

elif data_response.HasField("literal"):
return Literal.from_flyte_idl(data_response.literal)
elif data_response.HasField("pre_signed_urls"):
Expand Down
Loading