Skip to content

Swarming: Implement JSON env var encapsulation and v2 API protos#5170

Merged
IvanBM18 merged 16 commits intomasterfrom
feature/clusterfuzz-swarming-integration
Mar 2, 2026
Merged

Swarming: Implement JSON env var encapsulation and v2 API protos#5170
IvanBM18 merged 16 commits intomasterfrom
feature/clusterfuzz-swarming-integration

Conversation

@IvanBM18
Copy link
Copy Markdown
Collaborator

@IvanBM18 IvanBM18 commented Feb 25, 2026

Finishes the last details in the base of clusterfuzz-swarming integration.

This PR finalizes the base integration for Clusterfuzz-Swarming. The primary focus is ensuring environment variable persistence across Docker/ swarming bots and laying the groundwork for the Swarming v2 API.

  • Encapsulates all of the env vars in a single JSON env var, so that this JSON is be processed by a startup script. This is done so that the env vars are not lost in swarming bots that launch clusterfuzz in a docker container.
  • Simplified the way we check if a task is a swarming task to avoid creating unused newTaskRequest objects and too many quries into the db, resulting in a refactor of various related methods
  • Adds new protos for the swarming v2 api
  • Also adds some unit tests.

This integration will later be refactored to use remote_tasks once the remote task gate allows to send tasks to specific backends always that some conditions are given.

Bug: b/479476219

@IvanBM18 IvanBM18 self-assigned this Feb 25, 2026
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
@jardondiego
Copy link
Copy Markdown
Collaborator

I think it's important to be more specific with both the title and description.

@@ -0,0 +1,18 @@
# Copyright 2023 Google LLC
Copy link
Copy Markdown
Collaborator

@jardondiego jardondiego Feb 25, 2026

Choose a reason for hiding this comment

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

Sorry I am not sure if these gRPC should be on this PR. Are they needed for changes in swarming/__init__.py?

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.

All of the used protos in this repo live under src/_internal/protos, i just added the ones that were missing but maybe @letitz can give more context here

@IvanBM18 IvanBM18 changed the title ClusterFuzz & Swarming Integration Swarming: Implement JSON env var encapsulation and v2 API protos Feb 25, 2026
@IvanBM18
Copy link
Copy Markdown
Collaborator Author

I think it's important to be more specific with both the title and description.

Yeah i guess it was a little bit to generic, thanks for the feedback

Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/protos/swarming_pb2.pyi Outdated
@@ -35,8 +36,10 @@ def _requires_gpu() -> bool:

def is_swarming_task(command: str, job_name: str):
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.

Are moving this file logic to be under a swarming service that implements the RemoteTaskInterface?

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.

Yes. The plan is to eventually migrate it to use the Remote Task interface.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes. The plan is to eventually migrate it to use the Remote Task interface.

How it's not me...?

Copy link
Copy Markdown
Collaborator

@letitz letitz left a comment

Choose a reason for hiding this comment

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

Good stuff! A couple comments below.

Comment thread src/clusterfuzz/_internal/protos/swarming_pb2_grpc.py
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/swarming/swarming_test.py Outdated
Comment thread src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py
Comment thread src/clusterfuzz/_internal/bot/tasks/task_types.py Outdated
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/swarming/swarming_test.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/swarming/swarming_test.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/swarming/swarming_test.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/swarming/swarming_test.py Outdated
@sadmanshakib396-png
Copy link
Copy Markdown

Ok 💭 but liitle bit time need to understand about the theme

Copy link
Copy Markdown
Collaborator

@letitz letitz left a comment

Choose a reason for hiding this comment

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

One last question around the environment variables, and a couple debug statements to be removed. LGTM otherwise.

Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/swarming/__init__.py Outdated
Comment thread src/clusterfuzz/_internal/swarming/__init__.py
@IvanBM18 IvanBM18 merged commit c964710 into master Mar 2, 2026
11 checks passed
@IvanBM18 IvanBM18 deleted the feature/clusterfuzz-swarming-integration branch March 2, 2026 15:47
@javanlacerda
Copy link
Copy Markdown
Collaborator

It would be good testing it in the dev environment.

IvanBM18 added a commit that referenced this pull request Mar 2, 2026
## Finishes the last details in the base of clusterfuzz-swarming
integration.

This PR finalizes the base integration for Clusterfuzz-Swarming. The
primary focus is ensuring environment variable persistence across
Docker/ swarming bots and laying the groundwork for the Swarming v2 API.

- Encapsulates all of the env vars in a single JSON env var, so that
this JSON is be processed by a startup script. This is done so that the
env vars are not lost in swarming bots that launch clusterfuzz in a
docker container.
- Simplified the way we check if a task is a swarming task to avoid
creating unused newTaskRequest objects and too many quries into the db,
resulting in a refactor of various related methods
- Adds new protos for the swarming v2 api
- Also adds some unit tests.

This integration will later be refactored to use remote_tasks once the
remote task gate allows to send tasks to specific backends always that
some conditions are given.

Bug: b/479476219
jardondiego added a commit that referenced this pull request Mar 3, 2026
IvanBM18 pushed a commit that referenced this pull request Mar 4, 2026
IvanBM18 added a commit that referenced this pull request Mar 6, 2026
integration.

This PR finalizes the base integration for Clusterfuzz-Swarming. The
primary focus is ensuring environment variable persistence across
Docker/ swarming bots and laying the groundwork for the Swarming v2 API.

- Encapsulates all of the env vars in a single JSON env var, so that
this JSON is be processed by a startup script. This is done so that the
env vars are not lost in swarming bots that launch clusterfuzz in a
docker container.
- Simplified the way we check if a task is a swarming task to avoid
creating unused newTaskRequest objects and too many quries into the db,
resulting in a refactor of various related methods
- Adds new protos for the swarming v2 api
- Also adds some unit tests.

This integration will later be refactored to use remote_tasks once the
remote task gate allows to send tasks to specific backends always that
some conditions are given.

Bug: b/479476219
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.

5 participants