Skip to content

Commit d688107

Browse files
committed
set gcpbatchclient as client for batch service staticaly
Signed-off-by: Javan Lacerda <javanlacerda@google.com>
1 parent cec87d7 commit d688107

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/clusterfuzz/_internal/batch/gcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from google.cloud import batch_v1 as batch
2121

2222
from clusterfuzz._internal.base import retry
23-
from clusterfuzz._internal.remote_task import RemoteTaskInterface
2423
from clusterfuzz._internal.google_cloud_utils import credentials
2524
from clusterfuzz._internal.metrics import logs
25+
from clusterfuzz._internal.remote_task import RemoteTaskInterface
2626

2727
_local = threading.local()
2828

src/clusterfuzz/_internal/batch/service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from clusterfuzz._internal.base.tasks import task_utils
2222
from clusterfuzz._internal.batch.data_structures import BatchTask
2323
from clusterfuzz._internal.batch.data_structures import BatchWorkloadSpec
24+
from clusterfuzz._internal.batch.gcp import GcpBatchClient
2425
from clusterfuzz._internal.config import local_config
2526
from clusterfuzz._internal.datastore import data_types
2627
from clusterfuzz._internal.datastore import ndb_utils
@@ -174,8 +175,8 @@ def _get_specs_from_config(batch_tasks) -> Dict:
174175
class BatchService:
175176
"""Batch service."""
176177

177-
def __init__(self, client):
178-
self._client = client
178+
def __init__(self):
179+
self._client = GcpBatchClient()
179180

180181
def create_uworker_main_batch_job(self, module, job_type, input_download_url):
181182
command = task_utils.get_command_from_module(module)

src/clusterfuzz/_internal/google_cloud_utils/batch.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
from typing import List
1616

1717
from clusterfuzz._internal.batch.data_structures import BatchTask
18-
from clusterfuzz._internal.batch.gcp import GcpBatchClient
1918
from clusterfuzz._internal.batch.service import BatchService
2019

2120

2221
def create_uworker_main_batch_job(module, job_type, input_download_url):
2322
"""Creates a batch job."""
24-
service = BatchService(GcpBatchClient())
23+
service = BatchService()
2524
return service.create_uworker_main_batch_job(module, job_type,
2625
input_download_url)
2726

2827

2928
def create_uworker_main_batch_jobs(batch_tasks: List[BatchTask]):
3029
"""Creates batch jobs."""
31-
service = BatchService(GcpBatchClient())
30+
service = BatchService()
3231
return service.create_uworker_main_batch_jobs(batch_tasks)

0 commit comments

Comments
 (0)