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

Fix prefect deploy with dynamic @flow decorator args #13967

Merged
merged 6 commits into from
Jun 12, 2024

Conversation

collincchoy
Copy link
Contributor

Closes #13895 and #13950.

#13315 helped solve #9512 but in doing so introduced some regressions when using non-str type values for @flow arguments like name/description.

The key difference from changes introduced there is that we parse the flow name/description using an AST and as-is, args are expected to be raw str values and variables/expressions don't get evaluated correctly. This PR changes this by attempting to eval() when the value is not a constant.

If an arg is using a dependency that's not available in the current environment, then a message is logged to the user and the decorator arg is skipped, falling back to default behavior as if one was not supplied at all.

Note

Resolving relative imports for use here within the @flow decorator remains a bit tricky and should constitute a separate issue should that functionality be needed.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • This pull request includes a label categorizing the change e.g. maintenance, fix, feature, enhancement, docs.

For documentation changes:

  • This pull request includes redirect settings in mint.json for files that are removed or renamed.

For new functions or classes in the Python SDK:

  • This pull request includes helpful docstrings.
  • If a new Python file was added, this pull request contains a stub page in the Python SDK docs and an entry in docs/mint.json navigation.

@collincchoy collincchoy added the fix A fix for a bug in an existing feature label Jun 12, 2024
@collincchoy collincchoy requested a review from a team as a code owner June 12, 2024 17:42
Copy link
Collaborator

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

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

A definite improvement!

@collincchoy collincchoy merged commit 7090297 into main Jun 12, 2024
26 checks passed
@collincchoy collincchoy deleted the issue-13895/deploy-with-dynamic-flow-decorator-args branch June 12, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug in an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefect2.19.4 "AttributeError: 'JoinedStr' object has no attribute 'value'. Did you mean: 'values'?"
2 participants