Skip to content

Commit

Permalink
CTX-4184: Fix a bug where experiment logs did not get properly uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
dule1322 committed Jul 18, 2023
1 parent 43c9eff commit 969e175
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions coretex/project/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,28 @@ def onStart(self) -> None:
logging.getLogger("coretexpylib").info(result["message"])

def onSuccess(self) -> None:
pass
logging.getLogger("coretexpylib").info("Experiment finished successfully")

LogHandler.instance().flushLogs()
LogHandler.instance().reset()

def onKeyboardInterrupt(self) -> None:
pass

def onException(self, exception: BaseException) -> None:
logging.getLogger("coretexpylib").critical("Experiment failed to finish due to an error")
logging.getLogger("coretexpylib").debug(exception, exc_info = True)
logging.getLogger("coretexpylib").critical(str(exception))

LogHandler.instance().flushLogs()
LogHandler.instance().reset()

def onNetworkConnectionLost(self) -> None:
FolderManager.instance().clearTempFiles()

sys.exit(1)

def onCleanUp(self) -> None:
logging.getLogger("coretexpylib").info("Experiment execution finished")

self.workerProcess.kill()
self.workerProcess.join()

Expand All @@ -83,7 +88,4 @@ def onCleanUp(self) -> None:
except:
pass

LogHandler.instance().flushLogs()
LogHandler.instance().reset()

FolderManager.instance().clearTempFiles()
2 changes: 1 addition & 1 deletion coretex/project/experiment_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def experimentWorker(output: Connection, refreshToken: str, experimentId: int) -
sendSuccess(output, "Experiment worker succcessfully started")

while (parent := currentProcess.parent()) is not None:
logging.getLogger("coretexpylib").debug(f">> [Coretex] Worker process id {currentProcess.pid}, parent process id {parent.pid}...")
logging.getLogger("coretexpylib").debug(f">> [Coretex] Worker process id {currentProcess.pid}, parent process id {parent.pid}")

# If parent process ID is set to 1 then that means that the parent process has terminated
# the process (this is only true for Unix-based systems), but since we run the Node
Expand Down

0 comments on commit 969e175

Please sign in to comment.