Skip to content

Commit aef50a8

Browse files
committed
Use absolute paths for local dirs
This puts results and working files in a consistent location regardless of where the script is run. This also fixes a bug when the install-benchmark script is not run from the repo root.
1 parent 64b8155 commit aef50a8

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

scripts/ci/install-benchmark

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ GIT_OWNER = os.environ.get('GIT_OWNER', 'boto')
2020
# is set by jenkins to the branch that's been checked out via
2121
# git.
2222
PERF_BRANCH = os.environ.get('PERF_BRANCH', 'develop')
23-
WORKDIR = os.environ.get('PERF_WORKDIR', 'workdir')
23+
REPO_ROOT = os.path.dirname(
24+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
25+
WORKDIR = os.environ.get('PERF_WORKDIR', os.path.join(REPO_ROOT, 'workdir'))
2426

2527

2628
def clone_s3_transfer_repo():
@@ -36,7 +38,7 @@ def pip_install_s3transfer_and_deps():
3638
check_call('cd s3transfer && pip install -r requirements-dev.txt',
3739
shell=True)
3840
check_call('pip install "caf>=0.1.0,<1.0.0"', shell=True)
39-
check_call('cd ../ && pip install -e .', shell=True)
41+
check_call('cd %s && pip install -e .' % REPO_ROOT, shell=True)
4042

4143

4244
def create_workdir():

scripts/ci/run-benchmark

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import s3transfer
1919

2020

2121
TEST_BUCKET = os.environ.get('PERF_TEST_BUCKET')
22-
WORKDIR = os.environ.get('PERF_WORKDIR', 'workdir')
22+
REPO_ROOT = os.path.dirname(
23+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
24+
WORKDIR = os.environ.get('PERF_WORKDIR', os.path.join(REPO_ROOT, 'workdir'))
2325
MANY_FILES_DIR = 'many'
2426
LARGE_FILE_DIR = 'large'
2527

scripts/ci/upload-benchmark

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import argparse
55
from datetime import datetime
66
from subprocess import check_call
77

8-
WORKDIR = os.environ.get('PERF_WORKDIR', 'workdir')
8+
9+
REPO_ROOT = os.path.dirname(
10+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
11+
WORKDIR = os.environ.get('PERF_WORKDIR', os.path.join(REPO_ROOT, 'workdir'))
912
DEFAULT_BUCKET = os.environ.get('PERF_RESULTS_BUCKET')
1013
DATE_FORMAT = "%Y-%m-%d-%H-%M-%S-"
1114

0 commit comments

Comments
 (0)