Skip to content

Commit 131ec2a

Browse files
committed
change: allow only one integration test run per time
1 parent eefc539 commit 131ec2a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

buildspec.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,34 @@ phases:
3131
echo "skipping notebook test"
3232
fi
3333
34+
# wait its turn to run integration tests
35+
- ACCOUNT=$(aws sts get-caller-identity --output text | awk '{print $1}')
36+
- S3_BUCKET_DIR=s3://sagemaker-us-west-2-${ACCOUNT}/ci-lock
37+
38+
- |
39+
while true; do
40+
LAST_LOCK=$(aws s3 ls ${S3_BUCKET_DIR} | sort | tail -n 1 | awk '{print $4}')
41+
42+
if [[ -z "$LAST_LOCK" ]]
43+
then
44+
echo "No locks. Creating lock."
45+
LOCK_FILE=$(date +%s)
46+
touch ${LOCK_FILE}
47+
48+
aws s3 cp ${LOCK_FILE} ${S3_BUCKET_DIR}/${LOCK_FILE}
49+
50+
else
51+
echo "Waiting on lock."
52+
sleep 30
53+
fi
54+
done
55+
3456
# run integration tests
3557
- |
3658
if has-matching-changes "tests/" "src/*.py" "setup.py" "setup.cfg" "buildspec.yml"; then
3759
IGNORE_COVERAGE=- tox -e py36,py27 -- tests/integ -n 24 --boxed --reruns 2
3860
else
3961
echo "skipping integration tests"
4062
fi
63+
finally:
64+
- aws s3 rm --recursive ${S3_BUCKET_DIR}

0 commit comments

Comments
 (0)