Bug 1466660 - Remove use-artifact directory from run-task workers after task has finished r=jmaher

Right now artifacts from previous tasks are left lying around. We should clean these up
in case a task accidentally uses an artifact from the wrong dependency.

Ideally we'd cache these properly based on the taskId they came from, but that can be
follow-up fodder.

MozReview-Commit-ID: HUgvNlqyFav

--HG--
extra : rebase_source : fb9c6723598223619993c2695fb588ead3325edb
This commit is contained in:
Andrew Halberstadt 2018-06-04 16:36:28 -04:00
parent fe1b5d201f
commit cedce1ff81
2 changed files with 10 additions and 4 deletions

View File

@ -28,7 +28,7 @@ bench-ares6:
run:
command: >
cd $USE_ARTIFACT_PATH/build &&
unzip -q -d jsshell target.jsshell.zip &&
unzip -qo -d jsshell target.jsshell.zip &&
export JSSHELL=$USE_ARTIFACT_PATH/build/jsshell/js &&
cd $GECKO_PATH &&
./mach jsshell-bench --binary $JSSHELL --perfherder ares6
@ -40,7 +40,7 @@ bench-sixspeed:
run:
command: >
cd $USE_ARTIFACT_PATH/build &&
unzip -q -d jsshell target.jsshell.zip &&
unzip -qo -d jsshell target.jsshell.zip &&
export JSSHELL=$USE_ARTIFACT_PATH/build/jsshell/js &&
cd $GECKO_PATH &&
./mach jsshell-bench --binary $JSSHELL --perfherder six-speed

View File

@ -28,6 +28,7 @@ import io
import json
import os
import re
import shutil
import socket
import stat
import subprocess
@ -707,9 +708,10 @@ def main(args):
print('task should be defined in terms of non-symbolic revision')
return 1
use_artifact_path = os.environ.get('USE_ARTIFACT_PATH')
def prepare_use_artifact(key, url):
print_line(b'setup', b'fetching artifact from %s\n' % url.encode('utf-8'))
use_artifact_path = os.environ['USE_ARTIFACT_PATH']
path = os.path.join(use_artifact_path, key)
if not os.path.isdir(path):
os.makedirs(path)
@ -727,7 +729,11 @@ def main(args):
for url in urls:
prepare_use_artifact(key, url)
return run_and_prefix_output(b'task', task_args)
try:
return run_and_prefix_output(b'task', task_args)
finally:
if use_artifact_path and os.path.isdir(use_artifact_path):
shutil.rmtree(use_artifact_path)
if __name__ == '__main__':