-
Notifications
You must be signed in to change notification settings - Fork 38
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
Query just the information needed for Task Queue table #887
Conversation
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## deploy/hammer #887 +/- ##
=================================================
- Coverage 49.35% 45.46% -3.89%
=================================================
Files 285 292 +7
Lines 7564 8600 +1036
Branches 1050 1343 +293
=================================================
+ Hits 3733 3910 +177
- Misses 3682 4490 +808
- Partials 149 200 +51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
TaskQueueEntryPydantic = pydantic_model_creator( | ||
TaskState, exclude=("data", "category", "unix_millis_warn_time") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should start avoiding use of pydantic_model_creator
as it is not type safe. It's a bit troublesome to write it by hand but I think it is worth it. In the future we can consider a new generator that keep typings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I've created a separate model for returning
for r in results: | ||
status = r["status"] | ||
if "Status." in status: | ||
r["status"] = r["status"].split("Status.")[1] | ||
entries.append(TaskQueueEntryPydantic(**r)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid massaging the data for perf and consistency reasons, you can massage it on the frontend instead. Or at least refactor it so it is consistent, e.g., add the option to filter values to query_task_states
and just have query_task_queue_entry
call it with the filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I've moved the massaging to the frontend now
@@ -138,6 +139,74 @@ async def get_task_state( | |||
return result | |||
|
|||
|
|||
@router.get("/queue_entry", response_model=List[TaskQueueEntryPydantic]) | |||
async def query_task_queue_entry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docs explaining what it does, how is it different from querying task state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Converting back to draft since we have identified we don't have a bandwidth issue for now |
What's new
Self-checks