Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTX-4184: Fix a bug where experiment logs did not get properly uploaded #30

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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