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

Include the map_index in the default create_flow_run idempotency key #5443

Merged
merged 5 commits into from Mar 10, 2022

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Feb 15, 2022

Summary

Task in local flow.run calls do not have unique task run ids when mapped. Since create_flow_run uses the task_run_id as the default idempotency key, mapped calls in local runs will only result in a single flow run. To resolve this, we can include the map_index in the default idempotency key.

Note that when running with a backend, each task run (mapped or not) has a distinct UUID.

Changes

Appends the map_index to the default idempotency key if present in the context.

Extends test coverage for local runs, run names, and idempotency keys.

Importance

Mapping with create_flow_run in flow.run() does not work as intended otherwise.

Checklist

This PR:

  • adds new tests (if appropriate)
  • adds a change file in the changes/ directory (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

@zanieb zanieb changed the title Include the map_index in the default create_flow_run idempotency key to support local flow run mapping Include the map_index in the default create_flow_run idempotency key Feb 15, 2022
@zanieb zanieb mentioned this pull request Feb 23, 2022
@zanieb zanieb marked this pull request as ready for review March 10, 2022 15:45
@zanieb zanieb requested a review from desertaxle as a code owner March 10, 2022 15:45
@zanieb zanieb merged commit d62434c into master Mar 10, 2022
@zanieb zanieb deleted the map-index-key branch March 10, 2022 15:52
lance0805 pushed a commit to hyl2015/prefect that referenced this pull request Aug 2, 2022
…key (PrefectHQ#5443)

* Include the `map_index` in the default `create_flow_run` idempotency key to support local flow run mapping

* Fix logic if `task_run_id` is missing

* Add tests

* Add changes entry

* Update docstring
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