fix access to core_version in get_flow_run_command() #3177
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In #3113 , agents were changed to choose a different flow run command based on the current version of Prefect Core managing the flow. That PR added a default for
core_version
for the cases where{"core_version": null}
exists on the response. However, ifcore_version
is not present on the response at all, you get this hard-to-understand error:This PR fixes that.
Thanks for your time and consideration!
Changes
Changes to
utilities.agent.get_flow_run_command()
to usegetattr()
when looking forcore_version
in aflow_run
.Importance
I discovered this PR while running the unit tests for a custom
KubernetesAgent
that I've written with some my-company-specific logic. I was mocking theflow_run
contents and hadn't includedcore_version
. Others doing that might face this issue, and this PR will mitigate it.I'm not that familiar with GraphQL, so I don't know if you're guaranteed to get
{"core_version": null}
in the response if you ask for that field. If you aren't, then other people running versions of core that don't return this field would also face this issue without this fix.Checklist
changes/
directory (if appropriate)docs/outline.toml
for API reference docs (if appropriate)