diff --git a/Pilot/dirac-pilot.py b/Pilot/dirac-pilot.py index 472236d9..a4dc06f9 100644 --- a/Pilot/dirac-pilot.py +++ b/Pilot/dirac-pilot.py @@ -110,7 +110,6 @@ command, module = getCommand(pilotParams, commandName) if command is not None: command.log.info("Command %s instantiated from %s" % (commandName, module)) - command.log.buffer.flush() command.execute() else: log.error("Command %s could not be instantiated" % commandName) diff --git a/Pilot/pilotCommands.py b/Pilot/pilotCommands.py index 0674f396..1cf70c92 100644 --- a/Pilot/pilotCommands.py +++ b/Pilot/pilotCommands.py @@ -84,6 +84,7 @@ def wrapper(self): try: ret = func(self) + self.log.buffer.flush() return ret except SystemExit as exCode: # or Exception ? @@ -92,7 +93,7 @@ def wrapper(self): self.log.info( "Flushing the remote logger buffer for pilot on sys.exit(): %s (exit code:%s)" % (pRef, str(exCode)) ) - self.log.buffer.flush() # flush the buffer unconditionally (on sys.exit() and return). + self.log.buffer.flush() # flush the buffer unconditionally (on sys.exit()). try: sendMessage(self.log.url, self.log.pilotUUID, "finaliseLogs", {"retCode": str(exCode)}) except Exception as exc: