Skip to content

Commit

Permalink
Merge pull request #707 from mv1388/debug_mode_for_gpu_tests
Browse files Browse the repository at this point in the history
Optionally don't terminate the instance when running GPU tests
  • Loading branch information
mv1388 committed Jul 17, 2022
2 parents 6eeb241 + d102f87 commit 0905a76
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/AWS/test_core_pytorch_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function usage()
--instance-type STR instance type label; if this is provided the value from --instance-config is ignored
-i, --instance-config STR instance configuration json filename
--no-ssh after test job is submitted don't automatically ssh into the running instance
-d, --debug run in debug mode: run the tests, but don't terminate the instance at the end
-k, --key STR path to ssh key
-o, --os-name STR username depending on the OS chosen. Default is ubuntu
--on-demand create on-demand instance instead of spot instance
Expand All @@ -50,6 +51,7 @@ instance_type=
username="ubuntu"
py_env="pytorch"
ssh_at_start=true
debug_mode=false
spot_instance=true
aws_region="eu-west-1"

Expand Down Expand Up @@ -84,6 +86,10 @@ case $key in
ssh_at_start=false
shift 1 # past argument value
;;
-d|--debug)
debug_mode=true
shift 1 # past argument value
;;
-o|--os-name)
username="$2"
shift 2 # past argument value
Expand Down Expand Up @@ -154,13 +160,17 @@ scp -i $key_path -r ../../aitoolbox $username@$ec2_instance_address:~/package_te
scp -i $key_path -r ../../tests_gpu $username@$ec2_instance_address:~/package_test
scp -i $key_path ../../requirements.txt $username@$ec2_instance_address:~/package_test

terminate_setting=""
if [ "$debug_mode" == true ]; then
terminate_setting="aws ec2 terminate-instances --instance-ids $instance_id"
fi

#########################################################
# Bootstrapping the instance and execute the testing
#########################################################
echo "Running the comparison tests"
ssh -i $key_path $username@$ec2_instance_address \
"source activate $py_env ; tmux new-session -d -s 'training' 'export AWS_DEFAULT_REGION=$aws_region ; cd package_test ; pip install pytest datasets ; pip install -r requirements.txt ; python -m pytest $pytest_dir -s ; aws s3 cp $logging_path s3://aitoolbox-testing/core_pytorch_comparisson_testing/$logging_filename ; aws ec2 terminate-instances --instance-ids $instance_id' \; pipe-pane 'cat > $logging_path'"
"source activate $py_env ; tmux new-session -d -s 'training' 'export AWS_DEFAULT_REGION=$aws_region ; cd package_test ; pip install pytest datasets ; pip install -r requirements.txt ; python -m pytest $pytest_dir -s ; aws s3 cp $logging_path s3://aitoolbox-testing/core_pytorch_comparisson_testing/$logging_filename ; $terminate_setting' \; pipe-pane 'cat > $logging_path'"

echo "Instance IP: $ec2_instance_address"

Expand Down

0 comments on commit 0905a76

Please sign in to comment.