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

api-server: Support generic labels #949

Merged
merged 11 commits into from
Jun 5, 2024

Conversation

koonpeng
Copy link
Collaborator

What's new

Supports labels without requiring the schema to be strongly defined. This is still a bit hacky, it still assumes the label is a json with a description field while labels in RMF are free-form strings. RMF needs to support key value pair labels for us to be able to use them "natively".

Another issue is that tortoise-orm is lacking many features which prevent us to implement proper sorting on generic labels so we must still use hacks for the pickup and destination fields. We could use raw sql for this or drop support for sorting by labels.

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

Discussion

Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Copy link
Member

@aaronchongth aaronchongth left a comment

Choose a reason for hiding this comment

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

Looks good, just 1 question about the query route

@@ -99,10 +99,10 @@ async def query_task_states(
None, description="comma separated list of requester names"
),
pickup: Optional[str] = Query(
None, description="comma separated list of pickup names"
None, description="comma separated list of pickup names", deprecated=True
Copy link
Member

Choose a reason for hiding this comment

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

why is this marked as deprecated? Same for the destination query below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are being replaced with label=name=value, in main. Let me see if I can port generic label filtering over (already tested sorting doesn't work due to tortoise bug).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

managed to port label sorting over, this also fixes an issue with filtering where if you try to filter by pickup and destination you get no result even though there is a task that meets the criteria.

Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Copy link
Member

@aaronchongth aaronchongth left a comment

Choose a reason for hiding this comment

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

Looks like with the extra fields in the API, anywhere using this API needs to be updated too

packages/api-server/api_server/rmf_io/test_rmf_service.py Outdated Show resolved Hide resolved
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Copy link
Member

@aaronchongth aaronchongth left a comment

Choose a reason for hiding this comment

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

Thanks for setting this up! LGTM

@aaronchongth aaronchongth merged commit d39a031 into deploy/hammer Jun 5, 2024
3 checks passed
@aaronchongth aaronchongth deleted the koonpeng/generic-labels branch June 5, 2024 06:32
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.

2 participants