Skip to content

Add support for Swarming preprocess queue and task scheduling#5282

Open
IvanBM18 wants to merge 3 commits into
masterfrom
feature/swarming/swarming_cron_job_update
Open

Add support for Swarming preprocess queue and task scheduling#5282
IvanBM18 wants to merge 3 commits into
masterfrom
feature/swarming/swarming_cron_job_update

Conversation

@IvanBM18
Copy link
Copy Markdown
Collaborator

@IvanBM18 IvanBM18 commented May 18, 2026

Overview

This change adds support for scheduling tasks to the new Swarming backend. Because Swarming uses a different execution model and to be able to later account for backpressure it requires its own separate preprocess queue and a much lower default target size (5) to prevent unbounded task queuing.

By refactoring the cron scheduling logic, we can now simultaneously feed both the Swarming and Batch environments at their respective ideal rates.

Changes

  • Add a distinct SWARMING_PREPROCESS_TARGET_SIZE_DEFAULT set to 5 to support the Swarming backend's task capacity needs.
  • Define Swarming-specific queue mappings (SWARMING_QUEUES).
  • Refactor BaseFuzzTaskScheduler into an abstract base class with a generic _schedule_fuzz_tasks method to support multiple backends.
  • Update ChromeFuzzTaskScheduler to independently schedule Swarming tasks (_schedule_swarming_fuzz_tasks) alongside standard Batch tasks.
  • Update schedule_fuzz_test.py to match the updated scheduler class signatures.

TODO

  • src/clusterfuzz/_internal/base/feature_flags.py: Update this value based off dev & stage metrics and tests.

@IvanBM18 IvanBM18 requested a review from a team as a code owner May 18, 2026 05:28
@IvanBM18 IvanBM18 force-pushed the feature/swarming/swarming_cron_job_update branch from 4993e5d to 99bf603 Compare May 18, 2026 05:31
from clusterfuzz._internal.metrics import logs

PREPROCESS_TARGET_SIZE_DEFAULT = 10000
SWARMING_PREPROCESS_TARGET_SIZE_DEFAULT = 5
Copy link
Copy Markdown
Collaborator Author

@IvanBM18 IvanBM18 May 18, 2026

Choose a reason for hiding this comment

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

The Swarming pool has a hard limit of 25 (LINUX) bots running 1 task each.

  • At average 1 hour per fuzzing/swarming task, those 25 bots can finish 4 to 5 tasks every 10 minutes (the interval the cron job runs)
  • Because the 2,000(in prod) preprocess tworkers instantly process the preprocess queue, the target size acts as an injection rate more than a buffer.

So, Injecting 5 tasks every 10 minutes matches the expected Swarming rate, preventing an infinitely growing backlog of stale tasks. This is still the default value, the real value is managed trough a feature flag, we will later tweak this feature flag based on metrics & how swarming handled this workload, so that we have a more acqurate value

@IvanBM18 IvanBM18 self-assigned this May 18, 2026
@IvanBM18 IvanBM18 added the swarming Changes related to the clusterfuzz-swarming integration label May 18, 2026
Copy link
Copy Markdown
Collaborator

@fernandofloresg fernandofloresg left a comment

Choose a reason for hiding this comment

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

lgtm just had one question

PREPROCESS_QUEUE_SIZE_LIMIT = 'preprocess_queue_size_limit'

SWARMING_REMOTE_EXECUTION = 'swarming_remote_execution'
# TODO(ibarba): Set this value based off dev & stage metrics and tests.
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.

is this still true? if this is going to master then is going to stage and prod ?

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.

Yes this is still true, right now no swarming related code executes outside of dev, we have a ton of featureFlags in place for this reason. So when this changes reach stage/prod they are going to be safe.

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.

2 participants