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

Enhance nested / ordered constant treatment #1829

Merged
merged 10 commits into from Dec 13, 2019
Merged

Enhance nested / ordered constant treatment #1829

merged 10 commits into from Dec 13, 2019

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Dec 11, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

This PR enhances the treatment of collections of constants, specifically nested collections and ordered collections.

Previously, collections of constants were represented as a Collection task with each item added as an upstream Constant (or Collection) dependency. This had two effects: first, it ignored order; second, it created a confusing graph because something like [1, 2, 3] would unexpectedly be represented by four tasks.

This PR examines nested objects to determine if they only contain constants. If they do, then the entire object is wrapped as a single Constant, preserving order and simplicity.

This PR also simplifies the convert_constants flag by removing it. Instead, if the result of as_task is a Constant, we simply add its value attribute to the flow's constants.

Why is this PR important?

As users are supplying more complex arguments to their tasks, they are discovering this undesirable behavior.

@codecov
Copy link

codecov bot commented Dec 11, 2019

Codecov Report

Merging #1829 into master will decrease coverage by 0.03%.
The diff coverage is 100%.

cicdw
cicdw previously approved these changes Dec 11, 2019
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Awesome

@jlowin
Copy link
Member Author

jlowin commented Dec 12, 2019

@cicdw updated changelog for 0.8.0

@cicdw
Copy link
Member

cicdw commented Dec 13, 2019

@jlowin sorry for the extremely delayed reviews on this - looks like there's a merge conflict in the changelog

@jlowin
Copy link
Member Author

jlowin commented Dec 13, 2019

Updated!

cicdw
cicdw previously approved these changes Dec 13, 2019
@cicdw cicdw merged commit c9c13ec into master Dec 13, 2019
@cicdw cicdw deleted the constants branch December 13, 2019 16:28
zanieb pushed a commit that referenced this pull request Jun 7, 2022
* Bumps minimum compatible prefect version

* Bumps ORION_API_VERSION
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.

None yet

2 participants