Skip to content

Commit

Permalink
Merge pull request #93 from AlexsLemonade/jashapiro/92-nextflow-resume
Browse files Browse the repository at this point in the history
Add nextflow -resume setup on workflow runs
  • Loading branch information
jashapiro authored Aug 19, 2024
2 parents d257179 + d699cc1 commit 76e1d69
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/run-batch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
options:
- staging
- prod
resume:
description: Use -resume flag for Nextflow launch
type: boolean
default: true

permissions:
id-token: write # This is required for requesting the JWT
Expand Down Expand Up @@ -62,12 +66,14 @@ jobs:
run_mode: ${{ github.event_name == 'push' && 'full' || inputs.run_mode }}
# default output mode is prod for release events, otherwise use the specified mode
output_mode: ${{ github.event_name == 'push' && 'prod' || inputs.output_mode }}
resume: ${{ github.event_name == 'push' && 'true' || inputs.resume }}
run: |
echo '#!/bin/bash' > scripts/tmux_launch.sh
echo "export GITHUB_TAG=$revision" >> scripts/tmux_launch.sh
echo "export DATA_RELEASE=$data_release" >> scripts/tmux_launch.sh
echo "export RUN_MODE=$run_mode" >> scripts/tmux_launch.sh
echo "export OUTPUT_MODE=$output_mode" >> scripts/tmux_launch.sh
echo "export RESUME=$resume" >> scripts/tmux_launch.sh
echo 'tmux new-session -d -s nextflow /opt/nextflow/scripts/run_nextflow.sh' >> scripts/tmux_launch.sh
chmod +x scripts/tmux_launch.sh
Expand Down
10 changes: 10 additions & 0 deletions scripts/run_nextflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ GITHUB_TAG=${GITHUB_TAG:-main}
DATA_RELEASE=${DATA_RELEASE:-default}
RUN_MODE=${RUN_MODE:-test}
OUTPUT_MODE=${OUTPUT_MODE:-staging}
RESUME=${RESUME:-false}

date=$(date "+%Y-%m-%d")
datetime=$(date "+%Y-%m-%dT%H%M")
Expand Down Expand Up @@ -77,6 +78,12 @@ if [ "$DATA_RELEASE" != "default" ]; then
fi
fi

if [ "$RESUME" == "true" ]; then
resume_flag="-resume"
else
resume_flag=""
fi

nextflow pull AlexsLemonade/OpenScPCA-nf -revision $GITHUB_TAG \
|| echo "Error pulling OpenScPCA-nf workflow with revision '$GITHUB_TAG'" >> run_errors.log

Expand Down Expand Up @@ -128,6 +135,7 @@ if [ "$RUN_MODE" == "full" ]; then
-with-report "${datetime}_simulate_report.html" \
-with-trace "${datetime}_simulate_trace.txt" \
-with-tower \
$resume_flag \
$release_param \
|| echo "Error with simulate run" >> run_errors.log

Expand All @@ -142,6 +150,7 @@ if [ "$RUN_MODE" == "simulated" ] || [ "$RUN_MODE" == "full" ]; then
-with-report "${datetime}_simulated_report.html" \
-with-trace "${datetime}_simulated_trace.txt" \
-with-tower \
$resume_flag \
|| echo "Error with simulated data run" >> run_errors.log

cp .nextflow.log "${datetime}_simulated.log"
Expand All @@ -157,6 +166,7 @@ if [ "$RUN_MODE" == "scpca" ] || [ "$RUN_MODE" == "full" ]; then
-with-report "${datetime}_scpca_report.html" \
-with-trace "${datetime}_scpca_trace.txt" \
-with-tower \
$resume_flag \
$release_param \
|| echo "Error with scpca data run" >> run_errors.log

Expand Down

0 comments on commit 76e1d69

Please sign in to comment.