Skip to content

APPS-1511, APPS-1566 Simplify nextflow pipeline applet subjob inputs #917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/python/dxpy/templating/templates/nextflow/src/nextflow.sh
Original file line number Diff line number Diff line change
@@ -103,9 +103,7 @@ on_exit() {
# wrap cache folder and upload cache.tar
if [[ -n "$(ls -A .nextflow)" ]]; then
tar -cf cache.tar .nextflow

CACHE_ID=$(dx upload "cache.tar" --path "$DX_CACHEDIR/$NXF_UUID/cache.tar" --no-progress --brief --wait -p -r) &&
echo "Upload cache of current session as file: $CACHE_ID" &&
nxf_dx_upload "cache.tar" "$DX_CACHEDIR/$NXF_UUID" &&
rm -f cache.tar ||
echo "Failed to upload cache of current session $NXF_UUID"
else
@@ -422,10 +420,17 @@ main() {
exit $ret
}

nxf_dx_upload() {
local name=$1
local target=${2%/}
escape_name="${name//:/\\:}"
dx upload "$name" --path "$target/$escape_name" --no-progress --brief --wait -p -r | (echo -n "Upload $name to $target/$escape_name: " && cat) || true
}

nf_task_exit() {
ret=$?
if [ -f .command.log ]; then
dx upload .command.log --path "${cmd_log_file}" --brief --wait --no-progress || true
nxf_dx_upload .command.log "$TASK_WORKDIR"
else
>&2 echo "Missing Nextflow .command.log file"
fi
@@ -453,8 +458,9 @@ nf_task_entry() {
fi
# capture the exit code
trap nf_task_exit EXIT

# remove the line in .command.run to disable printing env vars if debugging is on
dx cat "${cmd_launcher_file}" | sed 's/\[\[ $NXF_DEBUG > 0 ]] && nxf_env//' > .command.run
dx cat "${TASK_WORKDIR}/.command.run" | sed 's/\[\[ $NXF_DEBUG > 0 ]] && nxf_env//' > .command.run
set +e
# enable debugging mode
[[ $NXF_DEBUG ]] && set -x