Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit bced899

Browse files
committed
improve nextflow entrypoint script
* describe arguments * change variable NEXFLOW_SCRIPT to NEXTFLOW_PROJECT * add check for AWS_BATCH_* variabes for GUID * allow github project specifications * exclude "runs/" from s3
1 parent ef98040 commit bced899

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/containers/nextflow/nextflow.aws.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
2-
echo $@
3-
NEXTFLOW_SCRIPT=$1
2+
# $1 S3 URI to Nextflow project files. If not using S3 set to "".
3+
# $2.. Additional parameters passed on to the nextflow cli
4+
5+
echo "$@"
6+
NEXTFLOW_PROJECT=$1
47
shift
5-
NEXTFLOW_PARAMS=$@
8+
NEXTFLOW_PARAMS="$@"
69

710
# Create the default config using environment variables
811
# passed into the container
9-
mkdir -p /opt/config
1012
NF_CONFIG=~/.nextflow/config
1113

1214
cat << EOF > $NF_CONFIG
@@ -21,13 +23,19 @@ EOF
2123
# to create a unique path
2224
GUID="$AWS_BATCH_JOB_ID/$AWS_BATCH_JOB_ATTEMPT"
2325

26+
if [ "$GUID" = "/" ]; then
27+
GUID=`date | md5sum | cut -d " " -f 1`
28+
fi
29+
2430
mkdir -p /opt/work/$GUID
2531
cd /opt/work/$GUID
2632

2733
# stage workflow definition
28-
aws s3 sync --only-show-errors --exclude '.*' $NEXTFLOW_SCRIPT .
29-
30-
NF_FILE=$(find . -name "*.nf" -maxdepth 1)
34+
$NF_FILE=""
35+
if [ ! -z "$NEXTFLOW_PROJECT" ]; then
36+
aws s3 sync --only-show-errors --exclude 'runs/*' --exclude '.*' $NEXTFLOW_PROJECT .
37+
NF_FILE=$(find . -maxdepth 1 -name "*.nf")
38+
fi
3139

3240
echo "== Running Workflow =="
3341
echo "nextflow run $NF_FILE $NEXTFLOW_PARAMS"

0 commit comments

Comments
 (0)