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

Add CLI command to read runs in WQ #11989

Merged
merged 3 commits into from
Feb 16, 2024
Merged

Conversation

urimandujano
Copy link
Contributor

This PR adds a CLI command to make it easy to read the runs off of a work queue:

❯ prefect work-queue read-runs --pool local-process-wp local-wq-2
Read 0 runs for work queue 'local-wq-2' in work pool local-process-wp: []

My main use case was simulating a worker/agent poll to a work queue to simulate work queue status events. The command was useful during testing and I can image it being useful to test other work queue status related things (i.e. automations, events). Note that running this command is equivalent to a worker polling a work queue and may lead to a temporary false positive where it looks like "something is polling for work" but it was just a one time command.

Example

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.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. maintenance, fix, feature, enhancement, docs.

For documentation changes:

  • This pull request includes redirect settings in netlify.toml for files that are removed or renamed.

For new functions or classes in the Python SDK:

  • This pull request includes helpful docstrings.
  • If a new Python file was added, this pull request contains a stub page in the Python SDK docs and an entry in mkdocs.yml navigation.

@urimandujano urimandujano requested a review from a team as a code owner February 14, 2024 22:27
Copy link

netlify bot commented Feb 14, 2024

Deploy Preview for prefect-docs-preview ready!

Name Link
🔨 Latest commit 7a2c636
🔍 Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/65cfcfcbe20ade0008cf260d
😎 Deploy Preview https://deploy-preview-11989--prefect-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


@work_app.command("read-runs")
@experimental_parameter("pool", group="work_pools", when=lambda y: y is not None)
async def read_wq_runs(
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to have a couple tests around this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a few tests! Let me know if you think there are edge cases I should be testing for.

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems to hit all the notes, thank you!

Copy link
Contributor

@bunchesofdonald bunchesofdonald left a comment

Choose a reason for hiding this comment

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

🙌


@work_app.command("read-runs")
@experimental_parameter("pool", group="work_pools", when=lambda y: y is not None)
async def read_wq_runs(
Copy link
Contributor

Choose a reason for hiding this comment

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

That seems to hit all the notes, thank you!

@urimandujano urimandujano merged commit 83c94c7 into main Feb 16, 2024
44 checks passed
@urimandujano urimandujano deleted the ft/add-get-wq-runs-to-cli branch February 16, 2024 21:48
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