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

[flyteagent] All agents return dict instead of literal map #2762

Merged

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Sep 21, 2024

Tracking issue

flyteorg/flyte#3936

Why are the changes needed?

When users trace the code, they tend to follow patterns we use in Flytekit's agent. By allowing them to use dict instead of LiteralMap, we can improve their development experience. This way, they don't need to understand the details of how LiteralMap works or what a literal is.

What changes were proposed in this pull request?

In the agent's get request:

Before:

  • Returns a LiteralMap.

After:

  • Returns a dict.

Note: We will automatically handle the conversion from dict to LiteralMap for the user.

How was this patch tested?

Through unit tests.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

@@ -90,7 +90,7 @@ def __init__(self):
resource = agent.get(metadata)
assert resource.phase == TaskExecution.SUCCEEDED
assert (
resource.outputs.literals["results"].scalar.structured_dataset.uri
resource.outputs["results"].uri
Copy link
Member

Choose a reason for hiding this comment

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

Technically, if there is another library that depends on resource.outputs.literals being defined, then this breaks backward compatibility.

I do not think there are anyone that depends on this, so I am okay with this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much for thinking so carefully

@Future-Outlier Future-Outlier merged commit 94786cf into master Sep 22, 2024
101 of 103 checks passed
kumare3 pushed a commit that referenced this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants