From b03b5a5355c5e384c9c13032f51149da029495a2 Mon Sep 17 00:00:00 2001
From: Yun-Jing Huang <yun-jing.huang@ligo.org>
Date: Wed, 14 Jun 2023 19:47:35 +0000
Subject: [PATCH] dags/layers/inspiral.py : enable injection jobs to point at
 different datasource than non-injection

---
 gstlal-inspiral/python/config/inspiral.py      | 4 ++++
 gstlal-inspiral/python/dags/layers/inspiral.py | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gstlal-inspiral/python/config/inspiral.py b/gstlal-inspiral/python/config/inspiral.py
index 04b2c63cfb..7510497d28 100644
--- a/gstlal-inspiral/python/config/inspiral.py
+++ b/gstlal-inspiral/python/config/inspiral.py
@@ -17,6 +17,7 @@
 
 import json
 import os
+import sys
 
 from ligo.segments import segment
 
@@ -90,6 +91,9 @@ class Config(BaseConfig):
 		if self.filter.injections:
 			if not self.source.inj_channel_name:
 				raise ValueError('Must provide injection channel names when config.filter.injections is set.')
+			if not self.source.inj_shared_memory_dir:
+				print('WARNING: no inj-shared-memory-dir specified in config, defaulting to use shared-memory-dir.', file=sys.stderr)
+				self.source.inj_shared_memory_dir = self.source.shared_memory_dir
 		else:
 			if self.upload.enable_injection_uploads:
 				raise ValueError('Cannot provide config.upload.enable_injection_uploads when config.filter.injections is not set.')
diff --git a/gstlal-inspiral/python/dags/layers/inspiral.py b/gstlal-inspiral/python/dags/layers/inspiral.py
index 535274d73e..964490b992 100644
--- a/gstlal-inspiral/python/dags/layers/inspiral.py
+++ b/gstlal-inspiral/python/dags/layers/inspiral.py
@@ -1741,7 +1741,7 @@ def filter_injections_online_layer(config, dag, svd_bank_cache, dist_stat_cache,
 	elif config.source.data_source == "devshm":
 		datasource_opts = [
 			Option("data-source", "devshm"),
-			Option("shared-memory-dir", dagutil.format_ifo_args(config.ifos, config.source.shared_memory_dir)),
+			Option("shared-memory-dir", dagutil.format_ifo_args(config.ifos, config.source.inj_shared_memory_dir)),
 			Option("shared-memory-block-size", config.source.shared_memory_block_size),
 			Option("shared-memory-assumed-duration", config.source.shared_memory_assumed_duration),
 		]
-- 
GitLab