playing with aws batch

This commit is contained in:
Jeffrey Paul 2018-09-15 08:10:25 -07:00
parent baa2dc836c
commit fb7dfd3b67
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#!/bin/bash
date
echo "Args: $@"
env
echo "This is my simple test job!."
echo "jobId: $AWS_BATCH_JOB_ID"
echo "jobQueue: $AWS_BATCH_JQ_NAME"
echo "computeEnvironment: $AWS_BATCH_CE_NAME"
sleep $1
date
echo "bye bye!!"

39
run-aws-job/run-job Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
export PATH="$HOME/Library/Homebrew/opt/gettext/bin:$PATH"
TS=$(date -u +%Y%m%d-%H%M%SZ)
BASE="s3://sneak-batch-inputs"
JOBSCRIPT="$BASE/$TS/job.sh"
aws s3 --region us-east-1 cp $1 $JOBSCRIPT
read -r JOBJSON <<EOF
{
"jobName": "$TS-job",
"jobQueue": "sneak-batch-queue",
"jobDefinition": "fetch-and-run",
"containerOverrides": {
"environment": [
{
"BATCH_FILE_TYPE": "",
"value": "script"
},
{
"BATCH_FILE_URL": "",
"value": "$JOBSCRIPT"
}
]
}
}
EOF
aws batch submit-job \
--job-name $TS-job \
--region us-west-2 \
--job-queue sneak-batch-queue \
--job-definition fetch-and-run \
--container-overrides \
vcpus=1,memory=1024,environment="[{name=BATCH_FILE_TYPE,value=script},{name=BATCH_FILE_URL,value=$JOBSCRIPT}]"