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

Update get_task to return the queue of the task #4699

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

svasudevprasad
Copy link
Collaborator

get_task has been updated to return the queue from which the task was originally obtained. This is requried so that in case the task cannot be currently executed, it is added back to the right queue.

Currently observed that a progression task for a old device like flame from jobs-android queue was being pushed to
jobs-android-mte-pixel8 queue

@svasudevprasad svasudevprasad force-pushed the push_tasks_to_right_queue branch from b16f68c to 4578334 Compare February 20, 2025 02:45
@svasudevprasad svasudevprasad marked this pull request as ready for review February 20, 2025 15:43
@@ -332,7 +332,7 @@ def get_task():
task queue."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is add_task unable to add the task back to the correct queue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is because the task does not store in the queue from which it was obtained. So add task will add it to the bots default queue. With subqueues, this is not correct since the task could be picked from the generic android queue in case subqueue was empty. So without this check, the task from generic android queue gets pushed to the bot based subqueue causing issues.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of adding an:

if android:
  get_queue_from_job()

here:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That wont work due to

task = get_regular_task(default_android_queue())

get_queue_from_job() will return the bot/job's subqueue

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why wouldn't it get the correct queue? The task is added to the correct queue by some mechanism in the first place, can we use that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me check

Copy link
Collaborator

Choose a reason for hiding this comment

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

A better option is to put the queue in the Task object. How invasive would this change be? It also would let us avoid the android special case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I felt that was too invasive and hence went with this approach. Also queue information inside task did not make sense. Isint task supposed to be independent of queue ?

Copy link
Collaborator

@jonathanmetzman jonathanmetzman Feb 26, 2025

Choose a reason for hiding this comment

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

I felt that was too invasive and hence went with this approach.

The current approach seems to force us to change a lot of functions for to deal with the subqueue problem.

Also queue information inside task did not make sense. Isint task supposed to be independent of queue ?

I think it is not independent in the subqeueue approach, and passing it alongside task doesn't really maintain this.

Could we use https://cloud.google.com/pubsub/docs/subscription-message-filter to avoid getting messages for the wrong platform/subplatform? I think it's worth looking to if deeper changes can solve the problems subqueue has at once. Maybe we can discuss this in the sync today.

@svasudevprasad svasudevprasad marked this pull request as draft March 4, 2025 19:02
get_task has been updated to return the queue from which the
task was originally obtained. This is requried so that in case
the task cannot be currently executed, it is added back to the
right queue.

Currently observed that a progression task for a old device like
flame from jobs-android queue was being pushed to
jobs-android-mte-pixel8 queue
@svasudevprasad svasudevprasad force-pushed the push_tasks_to_right_queue branch from 4578334 to b993a2b Compare March 4, 2025 21:25
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.

3 participants