Skip to content

Commit

Permalink
fix: move buffer flushing from dirac-pilot.py to PilotCommand wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
martynia committed Oct 27, 2023
1 parent ba18fb2 commit 92b14e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion Pilot/dirac-pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Pilot/pilotCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def wrapper(self):

try:
ret = func(self)
self.log.buffer.flush()
return ret

except SystemExit as exCode: # or Exception ?
Expand All @@ -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:
Expand Down

0 comments on commit 92b14e2

Please sign in to comment.