Skip to content

[Swarming] Adds Response proto & improves "unscheduled task" logic#5289

Open
IvanBM18 wants to merge 16 commits into
masterfrom
feature/swarming/respnse_proto
Open

[Swarming] Adds Response proto & improves "unscheduled task" logic#5289
IvanBM18 wants to merge 16 commits into
masterfrom
feature/swarming/respnse_proto

Conversation

@IvanBM18

@IvanBM18 IvanBM18 commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Overview

It was request for me to add a log to easily debug when swarming scheduled a task, but i noticed we didnt had the protos for parsing the response, hence i added them.

Also this PR handles an edge case in which swarming will not return a task_id if the tasks wasn't scheduled due to swarming related issues(not request, nor pc contract).

Background

This PR comes from a discussion & agreement to a required change from this PR

Changes

  • Adds the missing swarming_task_response proto
    • Ran protos/generate.sh which updated a ton of files
  • The swarming service now marks tasks as not scheduled when no task_id is found, task_id cannot be found if swarming didn't queue the task, because of wrong dimensions or other swarming internal reasons
  • As the count_tasks() api method, now the push_task() will also only raise SwarmingAPIErrors

@IvanBM18 IvanBM18 self-assigned this May 21, 2026
@IvanBM18 IvanBM18 added the swarming Changes related to the clusterfuzz-swarming integration label May 21, 2026
@@ -29,15 +29,15 @@
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2

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.

Changes autogenerated by the protos/genreate.sh script


global___NewTaskRequest = NewTaskRequest

@typing_extensions.final

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.

Changes autogenerated by the protos/genreate.sh script

if not swarming.is_swarming_task(task.job_type):
unscheduled_tasks.append(task)
continue
if not swarming.is_swarming_task(task.job_type):

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.

Note, this is marked as new lines because i moved the try downwards to line 133, so that we avoid unnecesay nesting,since the only method that really throws exceptions is located at line 134

@IvanBM18 IvanBM18 marked this pull request as ready for review June 10, 2026 06:20
@IvanBM18 IvanBM18 requested a review from a team as a code owner June 10, 2026 06:20
os_val = self._get_dimension(task_req, 'os')
pool_val = self._get_dimension(task_req, 'pool')
if not os_val or not pool_val:
logs.warning(f'[Swarming] Failed to find required dimension for job '

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.

why did you change to warning level? this looks like error level to me

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.

I think what Ivan is doing is this flow is whenever an error is detected he raises an Exception, rather than logging it as an error, apparently what happens after this part is that the job is added to "unscheduled" tasks, my question would be, what happens with unscheduled tasks later on the flow?

@IvanBM18 IvanBM18 Jun 10, 2026

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.

When the task is unscheduled it just returns to the queue.
i moved this to a warning because:

  • Errors should be things that we should immediately fix, warnings are just to keep note of them but they don't brake anything, in this case a non scheduled job doesn't break anything, but its worth noting
  • We already have the logs polluted with to many errors

cc: @Xeicker @fernandofloresg

@fernandofloresg fernandofloresg 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.

Other than Edgar's comment LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

swarming Changes related to the clusterfuzz-swarming integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants