Changeset View
Changeset View
Standalone View
Standalone View
benchmark.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import json | import json | ||||
import logging | import logging | ||||
import os | import os | ||||
from pathlib import Path | from pathlib import Path | ||||
import shutil | |||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
from tempfile import TemporaryDirectory | from tempfile import TemporaryDirectory | ||||
from typing import Set | from typing import Set | ||||
import click | import click | ||||
SEED_OPTIONS = ["-s 10", "-s 20", "-s 30"] | SEED_OPTIONS = ["-s 10", "-s 20", "-s 30"] | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | ): | ||||
processes = [ | processes = [ | ||||
subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr) | subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr) | ||||
for cmd in scenario_cmds | for cmd in scenario_cmds | ||||
] | ] | ||||
for proc in processes: | for proc in processes: | ||||
proc.wait() | proc.wait() | ||||
shutil.rmtree(extracted_repo_path) | |||||
@click.command( | @click.command( | ||||
help="""Run multiple benchmark from an input repository. The repository | help="""Run multiple benchmark from an input repository. The repository | ||||
will be unpacked in the provided temporary path and tested with | will be unpacked in the provided temporary path and tested with | ||||
the input algorithms.""" | the input algorithms.""" | ||||
) | ) | ||||
@click.argument("repo_path", type=click.Path(exists=True), required=True) | @click.argument("repo_path", type=click.Path(exists=True), required=True) | ||||
@click.argument("temp_path", type=click.Path(exists=True), required=True) | @click.argument("temp_path", type=click.Path(exists=True), required=True) | ||||
Show All 38 Lines |