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 access to core_version in get_flow_run_command() #3177

Merged
merged 3 commits into from Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions changes/pr3177.yaml
@@ -0,0 +1,5 @@
fix:
- "Fix access to `core_version` in Agent's `get_flow_run_command()` - [#3177](https://github.com/PrefectHQ/prefect/pull/3177)"

contributor:
- "[James Lamb](https://github.com/jameslamb)"
2 changes: 1 addition & 1 deletion src/prefect/utilities/agent.py
Expand Up @@ -52,7 +52,7 @@ def get_flow_run_command(flow_run: GraphQLResult) -> str:
Returns:
- str: a prefect CLI command to execute a flow run
"""
core_version = flow_run.flow.core_version or "0.0.0"
core_version = getattr(flow_run.flow, "core_version", None) or "0.0.0"

if LooseVersion(core_version) < LooseVersion("0.13.0"):
return "prefect execute cloud-flow"
Expand Down
18 changes: 18 additions & 0 deletions tests/utilities/test_agent.py
Expand Up @@ -86,3 +86,21 @@ def test_get_flow_run_command(core_version, command):
)

assert get_flow_run_command(flow_run) == command


def test_get_flow_run_command_works_if_core_version_not_on_response():
legacy_command = "prefect execute cloud-flow"
flow_run = GraphQLResult(
{
"flow": GraphQLResult(
{
"storage": Local().serialize(),
"environment": LocalEnvironment().serialize(),
"id": "id",
}
),
"id": "id",
}
)

assert get_flow_run_command(flow_run) == legacy_command