Skip to content
Open
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
25 changes: 25 additions & 0 deletions template/script.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ DB_PATH=${DB_PATH:-/srv/scratch/sbf-pipelines/proteinfold/dbs}
BRANCH=${BRANCH:-v2.0.0}
REPOSITORY=${REPOSITORY:-nf-core/proteinfold}
DEBUGGROUP=${DEBUGGROUP:-sbf}
METRICS_DIRECTORY=${METRICS_DIRECTORY:-/srv/scratch/sbf-pipelines/metrics}
ENABLE_METRICS=${ENABLE_METRICS:-true}

set -xo pipefail
set -eE
Expand Down Expand Up @@ -340,6 +342,29 @@ if [ "${SAVE_INTERMEDIATES}" == "true" ]; then
ARGS="${ARGS} --save_intermediates true"
fi

if [[ "${ENABLE_METRICS}" == "true" ]]; then
# Write metrics before starting the run Create yyyy/mm directory to avoid large file count in one directory and to make collecting metrics by month easier.
METRICS_LOG_PATH="${METRICS_DIRECTORY}/$(date +%Y/%m)"
mkdir -p "${METRICS_LOG_PATH}"

# Write json file containing job metrics.
NF_CONFIG="${NEXTFLOW_CONFIG_ARGS[@]}"
jq -n \
--arg date "$(date +%Y-%m-%dT%H:%M:%SZ%z)" \
--arg user "$(whoami)" \
--arg node "$(hostname)" \
--arg pbs_jobid "${PBS_JOBID}" \
--arg mode "${PROT_MODE}" \
--arg repository "${REPOSITORY}" \
--arg branch "${BRANCH}" \
--arg input "${SAMPLESHEET}" \
--arg outdir "${OUT_DIR}" \
--arg nf_config "${NF_CONFIG}" \
--arg args "${ARGS}" \
'{date: $date, user: $user, node: $node, pbs_jobid: $pbs_jobid, mode: $mode, repository: $repository, branch: $branch, input: $input, outdir: $outdir, nf_config: $nf_config, args: $args}' > "${METRICS_LOG_PATH}/$(date +%Y-%m-%dT%H:%M:%SZ%z)-$(whoami)-${PBS_JOBID%.*}.json"

fi

nextflow "${NEXTFLOW_CONFIG_ARGS[@]}" run ${REPOSITORY} -r ${BRANCH} -latest \
--input "${SAMPLESHEET}" \
--outdir "${OUT_DIR}" \
Expand Down
Loading