From 5d7b65b1cf71baec11566ee6c8461d8803352fc1 Mon Sep 17 00:00:00 2001
From: Cort Posnansky <cort.posnansky@ligo.org>
Date: Mon, 11 Dec 2023 15:26:53 -0500
Subject: [PATCH] config: remove getenv defaults and replace SINGULARITY_PWD
 with initialdir

---
 .../Makefile.online_inspiral_template         |  2 --
 gstlal/python/config/__init__.py              | 27 +++++++++----------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/gstlal-inspiral/python/workflows/templates/Makefile.online_inspiral_template b/gstlal-inspiral/python/workflows/templates/Makefile.online_inspiral_template
index f4b664bfac..33bff11407 100644
--- a/gstlal-inspiral/python/workflows/templates/Makefile.online_inspiral_template
+++ b/gstlal-inspiral/python/workflows/templates/Makefile.online_inspiral_template
@@ -86,8 +86,6 @@ online_%_{{ config.tag }}.dag : {{ config.svd.manifest }} $(HOME)/.config/gstlal
 
 {% endif %}
 	gstlal_ll_inspiral_workflow create -c config.yml --workflow $*
-	# FIXME: hack in place since dedicated nodes don't advertise singularity
-	sed -i 's/ && (HAS_SINGULARITY=?=True)//' *.sub
 	@echo ""
 
 {% if config.dcc %}
diff --git a/gstlal/python/config/__init__.py b/gstlal/python/config/__init__.py
index 9c866d242c..5a14f271c0 100644
--- a/gstlal/python/config/__init__.py
+++ b/gstlal/python/config/__init__.py
@@ -149,7 +149,7 @@ class Config:
 		profile = profiles.load_profile(condor_config["profile"])
 		assert profile["scheduler"] == "condor", "only scheduler=condor is allowed currently"
 
-		# add profile-specific options
+		# profile options
 		if "directives" in profile:
 			submit_opts.update(profile["directives"])
 		if "requirements" in profile:
@@ -157,24 +157,23 @@ class Config:
 		if "environment" in profile:
 			environment.update(profile["environment"])
 
-		# singularity-specific options
+		# singularity options
 		if "singularity_image" in condor_config:
 			singularity_image = condor_config["singularity_image"]
-			requirements.append("(HAS_SINGULARITY=?=True)")
 			submit_opts['+SingularityImage'] = f'"{singularity_image}"'
 			submit_opts['transfer_executable'] = False
-			submit_opts['getenv'] = False
-			if x509_proxy:
-				submit_opts['x509userproxy'] = x509_proxy
-				submit_opts['use_x509userproxy'] = True
-			if not self.condor.transfer_files:
-				# set the job's working directory to be the same as the current
-				# working directory to match the behavior of vanilla jobs
-				environment['SINGULARITY_PWD'] = self.rootdir
-		else:
-			submit_opts['getenv'] = True
 
-		# add config-specific options
+		# proxy options
+		if x509_proxy:
+			submit_opts['x509userproxy'] = x509_proxy
+			submit_opts['use_x509userproxy'] = True
+
+		# file transfer options
+		if not self.condor.transfer_files:
+			# set the job's working directory to be the current working directory
+			environment['initialdir'] = self.rootdir
+
+		# config options
 		if "directives" in condor_config:
 			submit_opts.update(condor_config["directives"])
 		if "requirements" in condor_config:
-- 
GitLab