Skip to content

[Scheduling][Swarming] Retries tasks only on meant platform - #5495

Merged
IvanBM18 merged 1 commit into
fix/swarming/unrecognized-remote-tasksfrom
fix/swarming/retries-tasks-without-blocking
Sep 28, 2026
Merged

IvanBM18 merged 1 commit into
fix/swarming/unrecognized-remote-tasksfrom
fix/swarming/retries-tasks-without-blocking

Conversation

@IvanBM18

@IvanBM18 IvanBM18 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

As found out in the parent PR: #5476

In the scheduler, when a task fails to get scheduled in swarming, it then tries to go on to other backends, so if for any reason(e.g. the platform is not supported in batch per the batch config), then the whole slice of batch tasks get rejected.

So for this PR, we make it so swarming tasks are only ever tried on swarming, and other tasks continue to be tried on other backends.

Also when making this changes i thought of an edge case not considered previously, what if there was a swarming task in the queue & then we disable the flag? Then the scheduled would mark the task as not swarming & would try it on other backends, and again this could show errors if the platform is not supported there. So i changed the validations.

With this changes task now appear in swarming!
image

Changes

  • swarming/__init__.py: Now we allow to validate if a given job is swarming or not without considering the flag.
  • remote_task_gate.py: Splits tasks in swarming and other, swarming tasks get redirected to the swarming service and the unscheduled tasks from this service are not added back again with the other tasks

Tests

  • A bunch of Tests + refactoring some tests to support this new edge cases.

  • Left this changes running in dev for 24 hours, and no longer saw the error that canceled the whole slice of batch tasks if the job platform didn't existed for batch,
    I only saw this error:

image

At first sight i also thought that a swarming job ended up being considered for batch, but we can ignore that because the real root cause to even being it considered for batch is because the job doesn't exist!

So, this kind of errors doesn't appear because of a swarming task was considered for batch, it appears because a non existen job was considered for batch, im positive this error happens because of the problems between the job-exporter and because that's a job that i manually inserted/scheduled to test the parent ticket.

@IvanBM18
IvanBM18 changed the base branch from master to fix/swarming/unrecognized-remote-tasks September 25, 2026 00:44
@IvanBM18
IvanBM18 added this pull request to stack #5496 September 25, 2026 00:44
@IvanBM18
IvanBM18 requested a review from dylanjew September 25, 2026 00:46
@IvanBM18 IvanBM18 added the swarming Changes related to the clusterfuzz-swarming integration label Sep 25, 2026
@IvanBM18
IvanBM18 marked this pull request as ready for review September 25, 2026 00:52
@IvanBM18
IvanBM18 requested review from a team as code owners September 25, 2026 00:52
# Should be routed normally to Kubernetes.
self.mock_k8s_service.create_utask_main_jobs.assert_called_once_with(tasks)

@mock.patch.object(remote_task_gate.RemoteTaskGate, '_is_swarming_applicable')

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For this tests i used this @mock annotation convention because it was how this class mocks were setup and its way easier to continue to do so then to migrate them to our newer helpers.patch syntax.


def _is_swarming_task(self, job_type):
return swarming.is_swarming_task(job_type)
return swarming.is_swarming_task(job_type, ignore_feature_flag=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

instead of adding ignore_feature_flag in is_swarming_task, would it be clearer to check the feature flag before doing the action? e.g. before scheduling, before executing the task?

is_swarming_task sounds like a check that should always tell us whether a task is swarming or not, and we should have a separate is_swarming_enabled check before taking action.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In this bot's case, we do check for the flag existence before doing the action (pulling tasks), but if by the next action (scheduling) the flag is down, then is_swarming_task would return false.

It was meant to be this way so swarming jobs, were tried in other platforms, but things have changed.

Agree on your separation of responsabilities, but since is_swarming_task is used quite a lot, Does it works for you if i handle this in a separate Refactor PR?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yeah, follow up is fine. having to consider whether you should ignore_feature_flag in is_swarming_task seemed strange.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will be reviewed here: #5504

logs.info(
f'[Swarming] Swarming flag not enabled, {len(swarming_tasks)} tasks'
' unscheduled.')
unscheduled_tasks.extend(swarming_tasks)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what do we do with these unscheduled tasks if swarming is diabled? shouldn't they get thrown out?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

They get sent back to the utask_main-swarming queue, and they are not pulled back until the flag is turned on.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Also no more new tasks would be pushed, and since they are not pulled back to any bot, i don't think discarding them would be our go to.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks!

@dylanjew dylanjew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@IvanBM18 IvanBM18 added the ready for GOSST review Pull requests ready for GOSST team review label Sep 25, 2026

@ViniciustCosta ViniciustCosta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@IvanBM18
IvanBM18 force-pushed the fix/swarming/retries-tasks-without-blocking branch from 8d86442 to 11128be Compare September 28, 2026 19:58
@IvanBM18
IvanBM18 merged commit e8ccb0b into master Sep 28, 2026
14 checks passed
@IvanBM18
IvanBM18 deleted the fix/swarming/retries-tasks-without-blocking branch September 28, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for GOSST review Pull requests ready for GOSST team review swarming Changes related to the clusterfuzz-swarming integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants