Skip to content

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

def get_task():
"""Returns an ordinary (non-utask_main) task that is pulled from a ClusterFuzz
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
@svasudevprasad svasudevprasad force-pushed the push_tasks_to_right_queue branch from 4578334 to b993a2b Compare March 4, 2025 21:25
Copy link
Collaborator

@jonathanmetzman jonathanmetzman left a comment

Choose a reason for hiding this comment

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

lgtm

@jonathanmetzman
Copy link
Collaborator

Just fix the tests please

@svasudevprasad svasudevprasad marked this pull request as ready for review March 19, 2025 18:18
@svasudevprasad svasudevprasad force-pushed the push_tasks_to_right_queue branch from fbd6ead to b3659ea Compare April 7, 2025 17:30
@jonathanmetzman
Copy link
Collaborator

Here's failure:
Finished Step #4
Step #4: Ran 634 tests (3 skipped, 0 errors, 4 failures).
Step #4:
Step #4: FAILED (failures=4)
Step #4:
Step #4: Ran 172 tests in 47.548s
Step #4: ----------------------------------------------------------------------
Step #4:
Step #4:
Step #4: + test normal job jobs-linux
Step #4: - test normal job
Step #4: AssertionError: 'test normal job' != 'test normal job jobs-linux'
Step #4: self.assertEqual('test normal job', task.payload())
Step #4: File "/workspace/src/clusterfuzz/_internal/tests/appengine/common/tasks_test.py", line 101, in test_regular
Step #4: Traceback (most recent call last):
Step #4: ----------------------------------------------------------------------
Step #4: Test regular tasks.
Step #4: FAIL: test_regular (tests.appengine.common.tasks_test.with_cloud_emulators..decorator..Wrapped.test_regular)
Step #4: ======================================================================
Step #4:
Step #4:
Step #4: + test high job high-end-jobs-linux
Step #4: - test high job
Step #4: AssertionError: 'test high job' != 'test high job high-end-jobs-linux'
Step #4: self.assertEqual('test high job', task.payload())
Step #4: File "/workspace/src/clusterfuzz/_internal/tests/appengine/common/tasks_test.py", line 88, in test_high_end
Step #4: Traceback (most recent call last):
Step #4: ----------------------------------------------------------------------
Step #4: Test high end tasks.
Step #4: FAIL: test_high_end (tests.appengine.common.tasks_test.with_cloud_emulators..decorator..Wrapped.test_high_end)
Step #4: ======================================================================
Step #4:
Step #4:
Step #4: ? +++++++++++
Step #4: + test normal4 job jobs-linux
Step #4: - test normal4 job
Step #4: AssertionError: 'test normal4 job' != 'test normal4 job jobs-linux'
Step #4: self.assertEqual('test normal4 job', task.payload())
Step #4: File "/workspace/src/clusterfuzz/_internal/tests/appengine/common/tasks_test.py", line 127, in test_defer
Step #4: Traceback (most recent call last):
Step #4: ----------------------------------------------------------------------
Step #4: Test deferring tasks which shouldn't be run yet.
Step #4: FAIL: test_defer (tests.appengine.common.tasks_test.with_cloud_emulators..decorator..Wrapped.test_defer)
Step #4: ======================================================================
Step #4:
Step #4:
Step #4: ? +++++
Step #4: + test override job None
Step #4: - test override job
Step #4: AssertionError: 'test override job' != 'test override job None'
Step #4: self.assertEqual('test override job', task.payload())
Step #4: File "/workspace/src/clusterfuzz/_internal/tests/appengine/common/tasks_test.py", line 145, in test_command_override
Step #4: Traceback (most recent call last):
Step #4: ----------------------------------------------------------------------
Step #4: Test command override.
Step #4: FAIL: test_command_override (tests.appengine.common.tasks_test.with_cloud_emulators..decorator..Wrapped.test_command_override)

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
Added unittest for the newly added set_queue API in the task class.
Existing test_success test updated to mock the newly added API
@svasudevprasad svasudevprasad force-pushed the push_tasks_to_right_queue branch from b3659ea to a170b55 Compare April 24, 2025 15:01
@jonathanmetzman jonathanmetzman merged commit 44d02ae into google:master Apr 24, 2025
7 checks passed
@svasudevprasad svasudevprasad deleted the push_tasks_to_right_queue branch June 5, 2025 18:42
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