Merge branch 'master' of github.com:sneak/hacks

This commit is contained in:
Jeffrey Paul 2018-09-16 03:05:50 -07:00
commit f141ec151b
3 changed files with 52 additions and 1 deletions

View File

@ -10,7 +10,7 @@ O2_COLOR = \033[32;01m
PREFIX = "$(O2_COLOR)==>$(O1_COLOR)" PREFIX = "$(O2_COLOR)==>$(O1_COLOR)"
SUFFIX = "$(NO_COLOR)" SUFFIX = "$(NO_COLOR)"
default: backup default: clean
backup: clean mailoffsite databackup backup: clean mailoffsite databackup

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}]"