Browse Source

playing with aws batch

pull/1/head
Jeffrey Paul 2 years ago
parent
commit
fb7dfd3b67
2 changed files with 51 additions and 0 deletions
  1. +12
    -0
      run-aws-job/my-test-job.sh
  2. +39
    -0
      run-aws-job/run-job

+ 12
- 0
run-aws-job/my-test-job.sh 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
- 0
run-aws-job/run-job 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}]"

Loading…
Cancel
Save