From 90a5c569884ed7ef7d116daba2bdf999fa6d4a36 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Mon, 1 Apr 2019 13:01:29 -0700 Subject: [PATCH] offload scripts from win-test.sh Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18601 Differential Revision: D14711856 Pulled By: kostmo fbshipit-source-id: 75fe620541fe2903f69a53dbd1b6d51a0d718113 --- .../pytorch/win-test-helpers/download_image.py | 19 ++++++++++++ .jenkins/pytorch/win-test.sh | 36 ++++++++-------------- 2 files changed, 31 insertions(+), 24 deletions(-) create mode 100755 .jenkins/pytorch/win-test-helpers/download_image.py diff --git a/.jenkins/pytorch/win-test-helpers/download_image.py b/.jenkins/pytorch/win-test-helpers/download_image.py new file mode 100755 index 0000000..1356ee4 --- /dev/null +++ b/.jenkins/pytorch/win-test-helpers/download_image.py @@ -0,0 +1,19 @@ +import os +import sys +import boto3 +import botocore + +IMAGE_COMMIT_TAG = os.getenv('IMAGE_COMMIT_TAG') + +session = boto3.session.Session() +s3 = session.resource('s3') +BUCKET_NAME = 'ossci-windows-build' +KEY = 'pytorch/' + IMAGE_COMMIT_TAG + '.7z' +LOCAL_FILE_PATH = sys.argv[1] +try: + s3.Bucket(BUCKET_NAME).download_file(KEY, LOCAL_FILE_PATH) +except botocore.exceptions.ClientError as e: + if e.response['Error']['Code'] == "404": + print("The object does not exist.") + else: + raise diff --git a/.jenkins/pytorch/win-test.sh b/.jenkins/pytorch/win-test.sh index 330a956..70c0182 100755 --- a/.jenkins/pytorch/win-test.sh +++ b/.jenkins/pytorch/win-test.sh @@ -1,7 +1,9 @@ #!/bin/bash -e COMPACT_JOB_NAME=pytorch-win-ws2016-cuda9-cudnn7-py3-test -source "$(dirname "${BASH_SOURCE[0]}")/common.sh" + +SCRIPT_PARENT_DIR=$(dirname "${BASH_SOURCE[0]}") +source "$SCRIPT_PARENT_DIR/common.sh" export IMAGE_COMMIT_TAG=${BUILD_ENVIRONMENT}-${IMAGE_COMMIT_ID} if [[ ${JOB_NAME} == *"develop"* ]]; then @@ -17,29 +19,6 @@ if [ ! -z "$(ls $TMP_DIR/ci_scripts/*)" ]; then rm $TMP_DIR/ci_scripts/* fi -cat >$TMP_DIR/ci_scripts/download_image.py << EOL - -import os -import sys -import boto3 -import botocore - -IMAGE_COMMIT_TAG = os.getenv('IMAGE_COMMIT_TAG') - -session = boto3.session.Session() -s3 = session.resource('s3') -BUCKET_NAME = 'ossci-windows-build' -KEY = 'pytorch/'+IMAGE_COMMIT_TAG+'.7z' -LOCAL_FILE_PATH = sys.argv[1] -try: - s3.Bucket(BUCKET_NAME).download_file(KEY, LOCAL_FILE_PATH) -except botocore.exceptions.ClientError as e: - if e.response['Error']['Code'] == "404": - print("The object does not exist.") - else: - raise - -EOL cat >$TMP_DIR/ci_scripts/setup_pytorch_env.bat <