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

Worker removes flow_run id if fails to submit. #16561

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jeanluciano
Copy link
Contributor

@jeanluciano jeanluciano commented Dec 31, 2024

This PR fixes but where flow runs would be stuck in the AwaitingConcurrency if a concurreny limit was set at the deployment level. The bug can be summarized into:

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
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

@jeanluciano jeanluciano marked this pull request as ready for review December 31, 2024 20:00
Copy link

codspeed-hq bot commented Dec 31, 2024

CodSpeed Performance Report

Merging #16561 will not alter performance

Comparing jean/oss-5929-deployment-concurrency-limit-leaves-jobs-stuck-in (5ddc5a4) with main (660d1f3)

Summary

✅ 3 untouched benchmarks

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

It'd be good to add a regression test in addition to the suggested changes to the log levels.

src/prefect/workers/base.py Outdated Show resolved Hide resolved
src/prefect/workers/base.py Outdated Show resolved Hide resolved
src/prefect/workers/base.py Outdated Show resolved Hide resolved
@@ -972,6 +975,7 @@ async def _submit_run(self, flow_run: "FlowRun") -> None:

self._submitting_flow_run_ids.remove(flow_run.id)
else:
self._submitting_flow_run_ids.remove(flow_run.id)
Copy link
Member

Choose a reason for hiding this comment

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

After looking at this more closely, since we're removing from _submitting_flow_run_ids in both branches, you simplify this by moving the removal outside of the if/else statement like this:

if ready_to_submit:
     ...
else:
     self._release_limit_slot(flow_run.id)
self._submitting_flow_run_ids.remove(flow_run.id)

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants