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

2.x - Fix prefect deploy with dynamic @flow decorator args #13991

Merged

Conversation

collincchoy
Copy link
Contributor

Port of #13967 for 2.x.

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.

@collincchoy collincchoy added the fix A fix for a bug in an existing feature label Jun 12, 2024
@collincchoy collincchoy changed the base branch from main to 2.x June 12, 2024 21:04
@collincchoy collincchoy merged commit f49a9e9 into 2.x Jun 13, 2024
53 of 55 checks passed
@collincchoy collincchoy deleted the issue-13895/deploy-with-dynamic-flow-decorator-args-2.x branch June 13, 2024 14:21
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