Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling merge-with-nonprivate in command line args #1939

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 17 additions & 16 deletions experiment/run_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,9 @@

import jinja2
import yaml

from common import benchmark_utils
from common import experiment_utils
from common import filestore_utils
from common import filesystem
from common import fuzzer_utils
from common import gcloud
from common import gsutil
from common import logs
from common import new_process
from common import utils
from common import yaml_utils
from common import (benchmark_utils, experiment_utils, filestore_utils,
filesystem, fuzzer_utils, gcloud, gsutil, logs, new_process,
utils, yaml_utils)

BENCHMARKS_DIR = os.path.join(utils.ROOT_DIR, 'benchmarks')
FUZZERS_DIR = os.path.join(utils.ROOT_DIR, 'fuzzers')
Expand Down Expand Up @@ -309,7 +300,8 @@ def start_experiment( # pylint: disable=too-many-arguments
measurers_cpus: Optional[int] = None,
runners_cpus: Optional[int] = None,
region_coverage: bool = False,
custom_seed_corpus_dir: Optional[str] = None):
custom_seed_corpus_dir: Optional[str] = None,
merge_with_nonprivate: bool = True):
"""Start a fuzzer benchmarking experiment."""
if not allow_uncommitted_changes:
check_no_uncommitted_changes()
Expand Down Expand Up @@ -344,6 +336,7 @@ def start_experiment( # pylint: disable=too-many-arguments
if config['custom_seed_corpus_dir']:
validate_custom_seed_corpus(config['custom_seed_corpus_dir'],
benchmarks)
config['merge_with_nonprivate'] = merge_with_nonprivate

return start_experiment_from_full_config(config)

Expand Down Expand Up @@ -703,6 +696,12 @@ def run_experiment_main(args=None):
required=False,
default=False,
action='store_true')
parser.add_argument('-nm',
'--no-merge-with-nonprivate',
help='Do not merge past public experiment results',
required=False,
default=False,
action='store_true')
args = parser.parse_args(args)
fuzzers = args.fuzzers or all_fuzzers

Expand All @@ -726,8 +725,9 @@ def run_experiment_main(args=None):
f'{measurers_cpus}) you need to specify the runners cpus '
'argument too.')

if (runners_cpus if runners_cpus else 0) + (measurers_cpus if measurers_cpus
else 0) > os.cpu_count():
cpu_count = os.cpu_count()
if cpu_count and (runners_cpus if runners_cpus else 0) + (
measurers_cpus if measurers_cpus else 0) > cpu_count:
parser.error(f'The sum of runners ({runners_cpus}) and measurers cpus '
f'({measurers_cpus}) is greater than the available cpu '
f'cores (os.cpu_count()).')
Expand All @@ -753,7 +753,8 @@ def run_experiment_main(args=None):
measurers_cpus=measurers_cpus,
runners_cpus=runners_cpus,
region_coverage=args.region_coverage,
custom_seed_corpus_dir=args.custom_seed_corpus_dir)
custom_seed_corpus_dir=args.custom_seed_corpus_dir,
merge_with_nonprivate=not args.no_merge_with_nonprivate)
return 0


Expand Down
1 change: 1 addition & 0 deletions service/gcbrun_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from the last PR comment containing "/gcbrun" and pass it to run_experiment.py
which will run an experiment."""

# Dummy
import logging
import os
import sys
Expand Down
Loading