Skip to content

Commit a96e146

Browse files
authored
Revert "Swarming: Implement JSON env var encapsulation and v2 API protos" (#5188)
Reverts #5170
1 parent 90f9ae5 commit a96e146

File tree

6 files changed

+72
-831
lines changed

6 files changed

+72
-831
lines changed

src/clusterfuzz/_internal/bot/tasks/task_types.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def is_remote_utask(command, job):
115115
# Return True even if we can't query the db.
116116
return True
117117

118-
return batch_service.is_remote_task(command,
119-
job) or swarming.is_swarming_task(job)
118+
return batch_service.is_remote_task(
119+
command, job) or swarming.is_swarming_task(command, job)
120120

121121

122122
def task_main_runs_on_uworker():
@@ -178,12 +178,11 @@ def execute(self, task_argument, job_type, uworker_env):
178178
return
179179

180180
logs.info('Queueing utask for remote execution.', download_url=download_url)
181-
if request := swarming.create_new_task_request(command, job_type,
182-
download_url):
183-
swarming.push_swarming_task(request)
184-
else:
185-
assert batch_service.is_remote_task(command, job_type)
181+
if batch_service.is_remote_task(command, job_type):
186182
tasks.add_utask_main(command, download_url, job_type)
183+
else:
184+
assert swarming.is_swarming_task(command, job_type)
185+
swarming.push_swarming_task(command, download_url, job_type)
187186

188187
@logs.task_stage_context(logs.Stage.PREPROCESS)
189188
def preprocess(self, task_argument, job_type, uworker_env):

src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ def _timestamp_now() -> Timestamp:
6363
return ts
6464

6565

66-
def _get_execution_mode(job_type):
66+
def _get_execution_mode(utask_module, job_type):
6767
"""Determines whether this task in executed on swarming or batch."""
68-
if swarming.is_swarming_task(job_type):
68+
command = task_utils.get_command_from_module(utask_module.__name__)
69+
if swarming.is_swarming_task(command, job_type):
6970
return Mode.SWARMING
7071
return Mode.BATCH
7172

@@ -409,7 +410,7 @@ def tworker_preprocess(utask_module, task_argument, job_type, uworker_env):
409410
signed download URL for the uworker's input and the (unsigned) download URL
410411
for its output."""
411412
with _MetricRecorder(_Subtask.PREPROCESS) as recorder:
412-
execution_mode = _get_execution_mode(job_type)
413+
execution_mode = _get_execution_mode(utask_module, job_type)
413414
uworker_input = _preprocess(utask_module, task_argument, job_type,
414415
uworker_env, recorder, execution_mode)
415416
if not uworker_input:
@@ -500,7 +501,8 @@ def tworker_postprocess(output_download_url) -> None:
500501
task_utils.reset_task_stage_env()
501502

502503
utask_module = get_utask_module(uworker_output.uworker_input.module_name)
503-
execution_mode = _get_execution_mode(uworker_output.uworker_input.job_type)
504+
execution_mode = _get_execution_mode(utask_module,
505+
uworker_output.uworker_input.job_type)
504506
recorder.set_task_details(
505507
utask_module,
506508
uworker_output.uworker_input.job_type,

0 commit comments

Comments
 (0)