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

Query just the information needed for Task Queue table #887

Closed
wants to merge 10 commits into from

Conversation

aaronchongth
Copy link
Member

What's new

  • New API to return only the information required for the Task Queue table

Self-checks

  • I have prototyped this new feature (if necessary) on Figma
  • I'm familiar with and follow this Typescript guideline
  • I added unit-tests for new components
  • I tried testing edge cases
  • I tested the behavior of the components that interact with the backend, with an e2e test

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@aaronchongth aaronchongth changed the title Query just the information needed for the table and nothing more Query just the information needed for Task Queue table Jan 24, 2024
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 1133 lines in your changes are missing coverage. Please review.

Comparison is base (fe0e808) 49.35% compared to head (2a8a18a) 45.46%.
Report is 58 commits behind head on deploy/hammer.

Files Patch % Lines
packages/dashboard/src/components/map-app.tsx 0.00% 171 Missing ⚠️
...ackages/react-components/lib/tasks/create-task.tsx 17.56% 122 Missing ⚠️
.../dashboard/src/components/delivery-alert-store.tsx 0.00% 100 Missing ⚠️
...es/api-server/api_server/models/delivery_alerts.py 12.94% 74 Missing ⚠️
...kages/dashboard/src/components/tasks/tasks-app.tsx 0.00% 66 Missing ⚠️
packages/react-components/lib/tasks/utils.ts 4.76% 54 Missing and 6 partials ⚠️
packages/dashboard/src/components/door-summary.tsx 0.00% 51 Missing ⚠️
...shboard/src/components/tasks/task-cancellation.tsx 0.00% 48 Missing ⚠️
packages/dashboard/src/components/lift-summary.tsx 0.00% 47 Missing ⚠️
...ckages/api-server/api_server/repositories/tasks.py 43.58% 44 Missing ⚠️
... and 39 more
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     
Flag Coverage Δ
api-server 74.55% <42.40%> (-6.25%) ⬇️
rmf-auth ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Comment on lines 85 to 87
TaskQueueEntryPydantic = pydantic_model_creator(
TaskState, exclude=("data", "category", "unix_millis_warn_time")
)
Copy link
Collaborator

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.

Copy link
Member Author

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

Comment on lines 265 to 269
for r in results:
status = r["status"]
if "Status." in status:
r["status"] = r["status"].split("Status.")[1]
entries.append(TaskQueueEntryPydantic(**r))
Copy link
Collaborator

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.

Copy link
Member Author

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(
Copy link
Collaborator

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.

Copy link
Member Author

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>
@aaronchongth
Copy link
Member Author

Converting back to draft since we have identified we don't have a bandwidth issue for now

@aaronchongth aaronchongth marked this pull request as draft March 15, 2024 02:32
@aaronchongth aaronchongth deleted the hammer/new-query-api branch May 27, 2024 15:29
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