Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ def main():
'clean_indexes', help='Clean up undefined indexes (in index.yaml).')
parser_clean_indexes.add_argument(
'-c', '--config-dir', required=True, help='Path to application config.')

parser_create_config = subparsers.add_parser(
'create_config', help='Create a new deployment config.')
parser_create_config.add_argument(
Expand Down
6 changes: 6 additions & 0 deletions src/clusterfuzz/_internal/base/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
'regression': 24 * 60 * 60,
}


def get_task_duration(command):
"""Gets the duration of a task."""
return TASK_LEASE_SECONDS_BY_COMMAND.get(command, TASK_LEASE_SECONDS)


TASK_QUEUE_DISPLAY_NAMES = {
'LINUX': 'Linux',
'LINUX_WITH_GPU': 'Linux (with GPU)',
Expand Down
7 changes: 1 addition & 6 deletions src/clusterfuzz/_internal/batch/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ def _get_config_names(batch_tasks: List[RemoteTask]):
return config_map


def _get_task_duration(command):
return tasks.TASK_LEASE_SECONDS_BY_COMMAND.get(command,
tasks.TASK_LEASE_SECONDS)


WeightedSubconfig = collections.namedtuple('WeightedSubconfig',
['name', 'weight'])

Expand Down Expand Up @@ -293,7 +288,7 @@ def _get_specs_from_config(batch_tasks: List[RemoteTask]) -> Dict:
# Lower numbers are a lower priority, meaning less likely to run From:
# https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs
priority = 0 if task.command == 'fuzz' else 1
max_run_duration = f'{_get_task_duration(task.command)}s'
max_run_duration = f'{tasks.get_task_duration(task.command)}s'
# This saves us time and reduces fragementation, e.g. every linux fuzz task
# run in this call will run in the same zone.
if config_name not in subconfig_map:
Expand Down
3 changes: 3 additions & 0 deletions src/clusterfuzz/_internal/k8s/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from kubernetes import client as k8s_client
from kubernetes import config as k8s_config

from clusterfuzz._internal.base import tasks
from clusterfuzz._internal.base import utils
from clusterfuzz._internal.base.tasks import task_utils
from clusterfuzz._internal.config import local_config
Expand Down Expand Up @@ -146,6 +147,7 @@ def _create_job_body(config: KubernetesJobConfig, input_url: str,
'name': job_name
},
'spec': {
'activeDeadlineSeconds': tasks.get_task_duration(config.command),
'template': {
'spec': {
'serviceAccountName':
Expand Down Expand Up @@ -395,6 +397,7 @@ def create_kata_container_job(self, config: KubernetesJobConfig,
'name': job_name
},
'spec': {
'activeDeadlineSeconds': tasks.get_task_duration(config.command),
'template': {
'metadata': {
'labels': {
Expand Down
2 changes: 1 addition & 1 deletion src/clusterfuzz/_internal/remote_task/job_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# By default, all jobs are sent to the GCP Batch backend. This can be
# overridden on a per-job basis by setting the `K8S_JOBS_FREQUENCY`
# environment variable.
DEFAULT_FREQUENCY = {'gcp_batch': 1.0, 'kubernetes': 0.1}
DEFAULT_FREQUENCY = {'gcp_batch': 1.0, 'kubernetes': 0.0}


def get_job_frequency():
Expand Down
Loading