Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hattivatti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP-Public
hattivatti
Commits
af850e6c
Commit
af850e6c
authored
1 year ago
by
Benjamin Wingfield
Browse files
Options
Downloads
Patches
Plain Diff
replace callback with workflow-monitor
parent
558b3291
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data/templates/callback.txt
+7
-25
7 additions, 25 deletions
data/templates/callback.txt
data/templates/nxf.txt
+6
-7
6 additions, 7 deletions
data/templates/nxf.txt
src/slurm/job.rs
+4
-1
4 additions, 1 deletion
src/slurm/job.rs
with
17 additions
and
33 deletions
data/templates/callback.txt
+
7
−
25
View file @
af850e6c
# set up reporting job status to INTERVENE backend
# need to escape starting curly bracket to prevent templating error
# (the comment above only makes sense in the original template file)
callback_exit_handler() \{
# report the status of the job to the INTERVENE backend
exit_code=$?
if [ $exit_code -eq 0 ]; then
body='\{"status": "COMPLETED", "pipelineId": "{name}", "outdir": ""}'
else
body='\{"status": "FAILED", "pipelineId": "{name}", "outdir": ""}'
fi
# do a callback
url="https://dev.intervenegeneticscores.org/pipeline-manager/pipeline/csc/notify"
# escaping json is a pain
echo $body > callback.txt
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic $CALLBACK_TOKEN" --data @callback.txt $url
exit $exit_code
}
# run everything in "strict mode". error early, error often!
set -euxo pipefail
trap callback_exit_handler EXIT
# set up reporting job status to INTERVENE backend
# dependencies for workflow-monitor (python3.10 & requests library)
module load python-data/3.10-23.07
# run the monitor in the background
python3 {workflow_monitor_path} &
# ------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
data/templates/nxf.txt
+
6
−
7
View file @
af850e6c
# time to start doing work!
#
step 0.
load dependencies
# load dependencies
# (curl, jq, and singularity/apptainer are preloaded on Puhti)
module load nextflow/22.10.1
module load parallel
#
step 1:
transfer data in parallel
# transfer data in parallel
parallel --col-sep ' ' \
-a {work_dir}/{name}/transfer.txt \
java -Xmx256m \
...
...
@@ -23,7 +23,7 @@ set_tmpdir() \{
set_tmpdir
#
step 2:
run pgsc_calc and calculate some scores
# run pgsc_calc and calculate some scores
!
nextflow run {pgsc_calc_dir} -profile singularity \
-c {work_dir}/{name}/allas.config \
-params-file {work_dir}/{name}/params.json \
...
...
@@ -32,9 +32,8 @@ nextflow run {pgsc_calc_dir} -profile singularity \
--min_overlap 0.01 \
--max_cpus 40 \
--max_memory "32.GB" \
--parallel
# step 3: report job status to INTERVENE platform
# (automatically executed in callback_exit_handler by trap)
--parallel \
-with-weblog http://localhost:8000 \
-name {name}
# ------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
src/slurm/job.rs
+
4
−
1
View file @
af850e6c
...
...
@@ -157,6 +157,7 @@ struct NextflowContext {
#[derive(Serialize)]
struct
CallbackContext
{
name
:
String
,
workflow_monitor_path
:
String
}
/// Write nextflow parameters to working directory
...
...
@@ -236,7 +237,9 @@ fn render_callback(param: &PipelineParam) -> Callback {
let
mut
tt
=
TinyTemplate
::
new
();
tt
.add_template
(
"callback"
,
CALLBACK
)
.expect
(
"Template"
);
let
name
:
&
String
=
&
param
.id
;
let
context
=
CallbackContext
{
name
:
name
.clone
()
};
static
WORKFLOW_MONITOR_PATH
:
&
str
=
"/scratch/project_2004504/bwingfield/workflow-monitor/main.py"
;
let
context
=
CallbackContext
{
name
:
name
.clone
(),
workflow_monitor_path
:
WORKFLOW_MONITOR_PATH
.to_string
()
};
Callback
{
content
:
tt
.render
(
"callback"
,
&
context
)
.expect
(
"Rendered callback"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment