diff --git a/data/templates/callback.txt b/data/templates/callback.txt index 1d21c628a3b61e6040a96b158e147b12c57332e1..94fa74c0fa0a3176ca9d6189805b1417315d608f 100644 --- a/data/templates/callback.txt +++ b/data/templates/callback.txt @@ -8,7 +8,9 @@ set -euxo pipefail module load python-data/3.10-23.07 # run the monitor in the background -python3 {workflow_monitor_path} & +python3 {workflow_monitor_path} \ + --callback_token $CALLBACK_TOKEN \ + --namespace {namespace} & # grab workflow monitor pid workflow_monitor_pid=$! diff --git a/src/slurm/job.rs b/src/slurm/job.rs index 6949bca72ee007468703af018930b9b445347c43..77b8490a63ab73af7b767529fbfd2a54bc83d07b 100644 --- a/src/slurm/job.rs +++ b/src/slurm/job.rs @@ -35,7 +35,7 @@ impl JobRequest { fs::create_dir(&instance_wd.path).expect("Create working directory"); let header: Header = render_header(&&self.pipeline_param); - let callback: Callback = render_callback(&&self.pipeline_param); + let callback: Callback = render_callback(&&self.pipeline_param, &namespace); let vars: EnvVars = read_environment_variables(); let workflow: Workflow = render_nxf(&globus_path, &&self.pipeline_param, &wd.path, &namespace); let job = JobTemplate { header, callback, vars, workflow }; @@ -159,7 +159,8 @@ struct NextflowContext { #[derive(Serialize)] struct CallbackContext { name: String, - workflow_monitor_path: String + workflow_monitor_path: String, + namespace: String } /// Write nextflow parameters to working directory @@ -233,7 +234,7 @@ fn render_nxf(globus_path: &PathBuf, param: &PipelineParam, work_dir: &Path, nam } /// Render the callback using TinyTemplate -fn render_callback(param: &PipelineParam) -> Callback { +fn render_callback(param: &PipelineParam, namespace: &PlatformNamespace) -> Callback { /// included callback template static CALLBACK: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/data/templates/callback.txt")); let mut tt = TinyTemplate::new(); @@ -241,7 +242,9 @@ fn render_callback(param: &PipelineParam) -> Callback { let name: &String = ¶m.id; 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() }; + workflow_monitor_path: WORKFLOW_MONITOR_PATH.to_string(), + namespace: namespace.to_string() + }; Callback { content: tt.render("callback", &context).expect("Rendered callback") } }