Skip to content

Adds Feature Flag for Swarming tasks#5185

Open
IvanBM18 wants to merge 1 commit intomasterfrom
feature/swarming_feature_flag
Open

Adds Feature Flag for Swarming tasks#5185
IvanBM18 wants to merge 1 commit intomasterfrom
feature/swarming_feature_flag

Conversation

@IvanBM18
Copy link
Collaborator

@IvanBM18 IvanBM18 commented Mar 2, 2026

Adds a Feature flag so that we are able to control wether tasks in swarming will be able to be triggered or not trough an external value.

@IvanBM18 IvanBM18 self-assigned this Mar 2, 2026
@IvanBM18 IvanBM18 changed the title Adds Feature Branch for Swarming tasks Adds Feature Flag for Swarming tasks Mar 2, 2026
Copy link
Collaborator

@javanlacerda javanlacerda left a comment

Choose a reason for hiding this comment

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

Could you provide evidence that it's working in dev? As dev is not sync with master, you will probably need to have a commit that combines your implementation with this fix, and then cherry-pick it over dev.

@IvanBM18
Copy link
Collaborator Author

IvanBM18 commented Mar 3, 2026

Could you provide evidence that it's working in dev? As dev is not sync with master, you will probably need to have a commit that combines your implementation with this fix, and then cherry-pick it over dev.

Added some logs to dev env And here's a screenshot of some logs of tasks in dev that show the feature flag as false:
image

Copy link
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.

LGTM but you need a test :)

'clusterfuzz._internal.base.feature_flags.FeatureFlags'
])
self.mock._get_task_name.return_value = 'task_name' # pylint: disable=protected-access
self.mock.FeatureFlags.SWARMING_TASKS.enabled = True
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should have a test for create_new_task_request() when the feature flag is false.

Copy link
Collaborator

@javanlacerda javanlacerda left a comment

Choose a reason for hiding this comment

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

You need to test the entire implementation that regards swarming tasks with feature flag in dev and then provide evidence that even with the new code, we don't have any new error group.

"""Returns True if the task is supposed to run on swarming."""
# TODO: b/487716733 - Trigger swarming tasks for MAC and Windows
job = data_types.Job.query(data_types.Job.name == job_name).get()
if job is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if job is None or not feature_flags.FeatureFlags.SWARMING_TASKS.enabled:

The error we had in prod was when this is_swarming_task is called and the swarming environment is not set. You should check the feature flag here as well to avoid a blast radious error, as the is_swarming_task is being called for every task.

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