Skip to content

16658 work pool queue update events - #19688

Merged
zzstoatzz merged 26 commits into
PrefectHQ:mainfrom
F4RAN:16658-work-pool-queue-update-events
Dec 16, 2025
Merged

16658 work pool queue update events#19688
zzstoatzz merged 26 commits into
PrefectHQ:mainfrom
F4RAN:16658-work-pool-queue-update-events

Conversation

@F4RAN

@F4RAN F4RAN commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

This PR adds event emission for work pool and work queue field updates beyond status changes. Previously, events were only created when the status field changed. Now events are also emitted when user-updatable fields like description, concurrency_limit, priority, etc. are updated.

This enables automations based on configuration changes, such as notifying on Slack when a work pool's concurrency limit is updated or scaling resources when a work queue's priority changes.

Note: This PR also updates existing tests to reflect the new event emission behavior. Tests that previously only checked for status events now also verify updated events when non-status fields change.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
  • If this pull request adds new functionality, it includes unit tests that cover the changes
    • Added tests for work pool update events
    • Added tests for work queue update events (both API endpoints)
    • Added test for no-op updates (no event emitted)
  • If this pull request removes docs files, it includes redirect settings in mint.json.
    • N/A - no docs files removed
  • If this pull request adds functions or classes, it includes helpful docstrings.
    • All new functions include docstrings

F4RAN added 7 commits December 9, 2025 15:15
Add event emission for work pool and work queue field updates beyond
status changes. Events are created when user-updatable fields change:
- Work pools: description, base_job_template, concurrency_limit, storage_configuration
- Work queues: name, description, concurrency_limit, priority
Emit events when work pools and work queues are updated

Previously, events were only created when status changed. Now we also
emit events when other fields like description, concurrency_limit, or
priority are updated. This enables automations based on configuration
changes.

Events include the old and new values in the payload.
@github-actions github-actions Bot added the enhancement An improvement of an existing feature label Dec 9, 2025
@codspeed-hq

codspeed-hq Bot commented Dec 9, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #19688 will not alter performance

Comparing F4RAN:16658-work-pool-queue-update-events (e16ced8) with main (0f9515a)

Summary

✅ 2 untouched

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/prefect/server/models/workers.py Outdated

@desertaxle desertaxle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR @F4RAN! This looks solid; just a couple of requested changes from me!

Comment thread src/prefect/server/models/work_queues.py
Comment thread src/prefect/server/models/workers.py
Comment thread src/prefect/server/models/events.py Outdated
Comment thread src/prefect/server/models/events.py Outdated
Comment thread src/prefect/server/models/work_queues.py
Comment thread src/prefect/server/models/workers.py
Comment thread src/prefect/server/models/workers.py
F4RAN and others added 7 commits December 10, 2025 21:35
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
@F4RAN

F4RAN commented Dec 10, 2025

Copy link
Copy Markdown
Contributor Author

@desertaxle Thanks for the feedback! I've made the requested changes:

  • Removed duplicate reads in both work_queues.py and workers.py by reusing current_work_queue instead of reading from the database again
  • Updated tests accordingly

Happy to make any additional changes if needed!

@F4RAN
F4RAN requested a review from desertaxle December 10, 2025 20:15

@desertaxle desertaxle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This LGTM! @zzstoatzz do you want to give this one a look too?

@zzstoatzz zzstoatzz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sorry for delay! lgtm

@zzstoatzz
zzstoatzz merged commit 9baeb20 into PrefectHQ:main Dec 16, 2025
89 of 90 checks passed
sxarsky pushed a commit to sxarsky/prefect-testbot-eval that referenced this pull request Apr 9, 2026
Code-only replay for TestBot evaluation.
Tests have been stripped - TestBot should generate them.

Original PR: PrefectHQ/prefect#19688
sxarsky pushed a commit to sxarsky/prefect-testbot-eval that referenced this pull request Apr 9, 2026
Code-only replay for TestBot evaluation.
Tests have been stripped - TestBot should generate them.

Original PR: PrefectHQ/prefect#19688
Evaluation methodology: replay-and-diff
br413 pushed a commit to br413/prefect that referenced this pull request Jul 14, 2026
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work Pool and Work Queue update events

3 participants