diff --git a/Pilot/pilotCommands.py b/Pilot/pilotCommands.py index 4e219937..16779ace 100644 --- a/Pilot/pilotCommands.py +++ b/Pilot/pilotCommands.py @@ -193,8 +193,7 @@ def execute(self): self.log.error( "%s MB < %s MB, not enough local disk space available, exiting" % (diskSpace, self.pp.minDiskSpace) ) - sys.exit(1) - + self.exitWithError(1) class InstallDIRAC(CommandBase): """Basically, this is used to call dirac-install with the passed parameters. @@ -292,7 +291,7 @@ def _locateInstallationScript(self): self.pp.rootPath, ) ) - sys.exit(1) + self.exitWithError(1) try: # change permission of the script @@ -694,7 +693,7 @@ def execute(self): resourceDict = json.loads(resourceDict.strip().split("\n")[-1]) except ValueError: self.log.error("The pilot command output is not json compatible.") - sys.exit(1) + self.exitWithError(1) self.pp.queueParameters = resourceDict for queueParamName, queueParamValue in self.pp.queueParameters.items(): @@ -773,7 +772,7 @@ def execute(self): numberOfGPUs = 0 except ValueError: self.log.error("Wrong Command output %s" % result) - sys.exit(1) + self.exitWithError(1) # If NumberOfProcessors or MaxRAM are defined in the resource configuration, these # values are preferred @@ -1006,7 +1005,7 @@ def execute(self): self.log.info("Queue length (which is also set as CPUTimeLeft) is %f" % self.pp.jobCPUReq) except ValueError: self.log.error("Pilot command output does not have the correct format") - sys.exit(1) + self.exitWithError(1) # now setting this value in local file cfg = ["-FDMH"] if self.pp.useServerCertificate: diff --git a/Pilot/pilotTools.py b/Pilot/pilotTools.py index aab42654..db66f4a3 100644 --- a/Pilot/pilotTools.py +++ b/Pilot/pilotTools.py @@ -680,6 +680,10 @@ def executeAndGetOutput(self, cmd, environDict=None): def exitWithError(self, errorCode): """Wrapper around sys.exit()""" + self.log.info("Content of pilot.cfg") + with open("pilot.cfg") as f: + print(f.read()) + self.log.info("List of child processes of current PID:") retCode, _outData = self.executeAndGetOutput( "ps --forest -o pid,%%cpu,%%mem,tty,stat,time,cmd -g %d" % os.getpid()