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

Feature: API for task run counts by state #12244

Merged
merged 8 commits into from
Mar 14, 2024

Conversation

znicholasbrown
Copy link
Contributor

@znicholasbrown znicholasbrown commented Mar 11, 2024

This PR introduces a new route to the UI-API that counts task runs by state according to a given Union filter set. The intent is to fulfill the requirements for #12102, though the implementation is more generic, allowing us to pass any union filter.

Example

Hitting: /api/ui/task_runs/count with or without a union filter returns:

{
  "COMPLETED": 0,
  "FAILED": 0,
  "PENDING": 0,
  "RUNNING": 0,
  "CANCELLED": 0,
  "CRASHED": 0,
  "PAUSED": 0,
  "CANCELLING": 0,
  "SCHEDULED": 0,
}

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 new functions or classes in the Python SDK:

  • This pull request includes helpful docstrings.

@znicholasbrown znicholasbrown added feature A new feature observability Related to Observability features labels Mar 11, 2024
@znicholasbrown znicholasbrown requested review from zangell44 and a team as code owners March 11, 2024 18:11
Copy link

netlify bot commented Mar 11, 2024

Deploy Preview for prefect-docs-preview ready!

Name Link
🔨 Latest commit 27d036e
🔍 Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/65f3159f3550be000878d7ed
😎 Deploy Preview https://deploy-preview-12244--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.

Copy link
Collaborator

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

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

Solid!

@znicholasbrown
Copy link
Contributor Author

I think I might be missing something about how to set up fixtures for postgres (or maybe my implementation is incorrect) - anyone able to help me get these tests in a good state?

start_time=now,
end_time=now,
),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why the tests are failing, is that the case locally?

Do we need to commit these, e.g.
await session.commit()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oo maybe that's the missing piece

Copy link
Contributor

@serinamarie serinamarie left a comment

Choose a reason for hiding this comment

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

LGTM!

@znicholasbrown
Copy link
Contributor Author

znicholasbrown commented Mar 14, 2024

can't believe that's all it was missing, you're a genius @serinamarie, thanks for the help!

@znicholasbrown znicholasbrown merged commit 7728e51 into main Mar 14, 2024
45 checks passed
@znicholasbrown znicholasbrown deleted the nicholas/feature-ui-task-runs-count-2024-03-11 branch March 14, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature observability Related to Observability features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants