From d1457005ac93fd14ec53bf9911a32944b1dff69f Mon Sep 17 00:00:00 2001 From: Stefano Belforte Date: Fri, 25 Oct 2024 17:12:42 +0200 Subject: [PATCH] respect CRAB3_CACHE_FILE=/dev/null Fix #5337 (#5338) --- src/python/CRABClient/Commands/SubCommand.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python/CRABClient/Commands/SubCommand.py b/src/python/CRABClient/Commands/SubCommand.py index bc1c31c7..4a635cd4 100644 --- a/src/python/CRABClient/Commands/SubCommand.py +++ b/src/python/CRABClient/Commands/SubCommand.py @@ -559,6 +559,9 @@ def getConfiDict(self): Load the CRAB cache file (~/.crab3). If it doesn't exist, create one. """ crabCacheFileName = self.crabcachepath() + if '/dev/null' in crabCacheFileName: + configdict = {'crab_project_directory': ''} + return configdict if not os.path.isfile(crabCacheFileName): msg = "Could not find CRAB cache file %s; creating a new one." % (crabCacheFileName) self.logger.debug(msg) @@ -606,6 +609,8 @@ def updateCRABCacheFile(self): if self.cmdconf['requiresDirOption'] or getattr(self, 'requestarea', None): self.crab3dic['crab_project_directory'] = self.requestarea crabCacheFileName = self.crabcachepath() + if '/dev/null' in crabCacheFileName: + return crabCacheFileName_tmp = "%s.%s" % (crabCacheFileName, os.getpid()) with open(crabCacheFileName_tmp, 'w') as fd: json.dump(self.crab3dic, fd)