diff --git a/awsf3-docker/run.sh b/awsf3-docker/run.sh index 0789770b..8060e0e3 100755 --- a/awsf3-docker/run.sh +++ b/awsf3-docker/run.sh @@ -54,7 +54,7 @@ export LOCAL_WF_TMPDIR_CWL=$MOUNT_DIR_PREFIX$LOCAL_WF_TMPDIR # function that executes a command and collecting log exl(){ $@ >> $LOGFILE 2>> $LOGFILE; handle_error $?; } ## usage: exl command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. -exlj(){ $@ >> $LOGJSONFILE 2>> $LOGFILE; $ERRCODE=$?; cat $LOGJSONFILE >> $LOGFILE; handle_error $ERRCODE; } ## usage: exl command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. This one separates stdout to json as well. +exlj(){ $@ >> $LOGJSONFILE 2>> $LOGFILE; ERRCODE=$?; cat $LOGJSONFILE >> $LOGFILE; handle_error $ERRCODE; } ## usage: exl command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. This one separates stdout to json as well. exle(){ $@ >> /dev/null 2>> $LOGFILE; handle_error $?; } ## usage: exle command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. This one eats stdout. Useful for downloading/uploading files to/from s3, because it writes progress to stdout. exlo(){ $@ 2>> /dev/null >> $LOGFILE; handle_error $?; } ## usage: exlo command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. This one eats stderr. Useful for hiding long errors or credentials. diff --git a/awsf3/aws_run_workflow_generic.sh b/awsf3/aws_run_workflow_generic.sh index 0ebb718c..c6d98091 100755 --- a/awsf3/aws_run_workflow_generic.sh +++ b/awsf3/aws_run_workflow_generic.sh @@ -47,10 +47,12 @@ export LOGFILE2=$LOCAL_OUTDIR/$JOBID.log export STATUS=0 export ERRFILE=$LOCAL_OUTDIR/$JOBID.error # if this is found on s3, that means something went wrong. export INSTANCE_REGION=$(ec2metadata --availability-zone | sed 's/[a-z]$//') +export AWS_ACCOUNT_ID=$(aws sts get-caller-identity| grep Account | sed 's/[^0-9]//g') # function that executes a command and collecting log exl(){ $@ >> $LOGFILE 2>> $LOGFILE; handle_error $?; } ## usage: exl command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. +exlo(){ $@ 2>> /dev/null >> $LOGFILE; handle_error $?; } ## usage: exlo command ## ERRCODE has the error code for the command. if something is wrong, send error to s3. This one eats stderr. Useful for hiding long errors or credentials. # function that sends log to s3 (it requires LOGBUCKET to be defined, which is done by sourcing $ENV_FILE.) send_log(){ aws s3 cp $LOGFILE s3://$LOGBUCKET &>/dev/null; } ## usage: send_log (no argument) @@ -159,12 +161,21 @@ if [ ! -z $ACCESS_KEY -a ! -z $SECRET_KEY -a ! -z $REGION ]; then echo -ne "$ACCESS_KEY\n$SECRET_KEY\n$REGION\njson" | aws configure --profile user1 fi +### log into ECR if necessary +exl echo +exl echo "## Logging into ECR" +exl echo "Logging into ECR $AWS_ACCOUNT_ID.dkr.ecr.$INSTANCE_REGION.amazonaws.com..." +exlo docker login --username AWS --password $(aws ecr get-login-password --region $INSTANCE_REGION) $AWS_ACCOUNT_ID.dkr.ecr.$INSTANCE_REGION.amazonaws.com; +send_log + # send log before starting docker exl echo exl echo "## Running dockerized awsf scripts" send_log # run dockerized awsf scripts +exl docker pull $AWSF_IMAGE +send_log docker run --privileged --net host -v /home/ubuntu/:/home/ubuntu/:rw -v /mnt/:/mnt/:rw $AWSF_IMAGE run.sh -i $JOBID -l $LOGBUCKET -f $EBS_DEVICE -S $STATUS $SINGULARITY_OPTION_TO_PASS handle_error $? diff --git a/tibanna/_version.py b/tibanna/_version.py index 4a14e029..957e0ea3 100755 --- a/tibanna/_version.py +++ b/tibanna/_version.py @@ -1,4 +1,4 @@ """Version information.""" # The following line *must* be the last in the module, exactly as formatted: -__version__ = "1.4.1" +__version__ = "1.5.0"