Skip to content
Snippets Groups Projects
Commit fea1db89 authored by Benjamin Wingfield's avatar Benjamin Wingfield
Browse files

add namespace to workflow-monitor

parent 5e3db761
No related branches found
No related tags found
No related merge requests found
......@@ -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=$!
......
......@@ -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 = &param.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") }
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment