Skip to content

Commit 35c9000

Browse files
committed
Update run_remote_task.py and run_bot.py to use new RemoteTask and GcpBatchService
1 parent 7a93b46 commit 35c9000

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/local/butler/scripts/run_remote_task.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import contextlib
1717

1818
from clusterfuzz._internal.base import tasks
19+
from clusterfuzz._internal.batch.service import GcpBatchService
1920
from clusterfuzz._internal.metrics import monitoring_metrics
21+
from clusterfuzz._internal.remote_task import RemoteTask
2022
from clusterfuzz._internal.system import environment
2123

2224

@@ -35,7 +37,6 @@ def lease_all_tasks(task_list):
3537

3638
def schedule_utask_mains():
3739
"""Schedules utask_mains from preprocessed utasks on Google Cloud Batch."""
38-
from clusterfuzz._internal.google_cloud_utils import batch
3940

4041
print('Attempting to combine batch tasks.')
4142
utask_mains = tasks.get_utask_mains()
@@ -47,10 +48,10 @@ def schedule_utask_mains():
4748

4849
with lease_all_tasks(utask_mains):
4950
batch_tasks = [
50-
batch.RemoteTask(task.command, task.job, task.argument)
51+
RemoteTask(task.command, task.job, task.argument)
5152
for task in utask_mains
5253
]
53-
return batch.create_uworker_main_batch_jobs(batch_tasks)
54+
return GcpBatchService().create_uworker_main_batch_jobs(batch_tasks)
5455

5556

5657
def execute(*args, **kwargs): # pylint: disable=unused-argument

src/python/bot/startup/run_bot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# to be able to import dependencies directly, but we must store these in
1818
# subdirectories of common so that they are shared with App Engine.
1919
from clusterfuzz._internal.base import modules
20+
from clusterfuzz._internal.batch.service import GcpBatchService
21+
from clusterfuzz._internal.remote_task import RemoteTask
2022

2123
modules.fix_module_search_paths()
2224

@@ -84,9 +86,11 @@ def lease_all_tasks(task_list):
8486
yield
8587

8688

89+
gcp_batch_service = GcpBatchService()
90+
91+
8792
def schedule_utask_mains():
8893
"""Schedules utask_mains from preprocessed utasks on Google Cloud Batch."""
89-
from clusterfuzz._internal.google_cloud_utils import batch
9094

9195
logs.info('Attempting to combine batch tasks.')
9296
utask_mains = tasks.get_utask_mains()
@@ -98,10 +102,10 @@ def schedule_utask_mains():
98102

99103
with lease_all_tasks(utask_mains):
100104
batch_tasks = [
101-
batch.RemoteTask(task.command, task.job, task.argument)
105+
RemoteTask(task.command, task.job, task.argument)
102106
for task in utask_mains
103107
]
104-
batch.create_uworker_main_batch_jobs(batch_tasks)
108+
gcp_batch_service.create_uworker_main_batch_jobs(batch_tasks)
105109

106110

107111
def task_loop():

0 commit comments

Comments
 (0)