-
Notifications
You must be signed in to change notification settings - Fork 435
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
Allow to add annotations to the job queue by ID #9269
Conversation
8d14ee2
to
eb90061
Compare
@@ -10,7 +10,8 @@ class Priority: | |||
SINGLE_ITEM = 1 | |||
SINGLE_USER = 100 | |||
SINGLE_GROUP = 100 | |||
BETWEEN_TIMES = 1000 | |||
BETWEEN_TIMES = 1_000 |
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.
Use the thousands separator.
New property alias for "by_ids"
annotation_ids = [] | ||
for annotation_id in ids: | ||
# If the ID looks like an hex UUID, convert it to URL-safe | ||
if len(annotation_id) == 36: |
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.
The first use case for this (complete the annotation_slim job) will use the full UUID format as the IDs come directly from the DB.
I think it's just nicer to support both formats anyway.
h/services/job_queue.py
Outdated
application-level URL-safe format | ||
""" | ||
where = [Annotation.id.in_(annotation_ids)] | ||
self.add_where(name, where, tag, Priority.BY_IDS, force, schedule_in) |
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.
A minor thing but maybe it's worth passing the last two as keyword arguments like we do in add_annotations_by_ids
.
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 point, done.
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.
Looks good
eb90061
to
9bce094
Compare
9bce094
to
f114e80
Compare
For: #8727
Instead of writing a one off script or sql query to add the remaining annotations missing in annotation_slim we add a new option on the H admin pages to be able to add annotations by ID.
Testing
annotation_slim
rowsIn
make sql
:Go to the admin pages, http://localhost:5000/admin/search
Pick one annotation ID form the DB
Use that annotation ID on the textarea, select "Annotation Slim" as the job type
Process pending jobs locally, in
make shell