From 75046e7cc95f11225a54d71420ba8f4a39bcc855 Mon Sep 17 00:00:00 2001 From: Jeff Raubitschek Date: Wed, 29 Jul 2020 08:44:31 -0700 Subject: [PATCH] at exit_code to join (#106) --- wandb/sdk/wandb_run.py | 8 ++++---- wandb/sdk_py27/wandb_run.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wandb/sdk/wandb_run.py b/wandb/sdk/wandb_run.py index 31d20eea..19cdc00a 100644 --- a/wandb/sdk/wandb_run.py +++ b/wandb/sdk/wandb_run.py @@ -572,12 +572,12 @@ def restore( return None return files[0].download(root=root, replace=True) - def join(self): + def join(self, exit_code=None): """Marks a run as finished, and finishes uploading all data. This is used when creating multiple runs in the same process. We automatically call this method when your script exits. """ - self._atexit_cleanup() + self._atexit_cleanup(exit_code=exit_code) if len(self._wl._global_run_stack) > 0: self._wl._global_run_stack.pop() @@ -685,7 +685,7 @@ def _restore(self): sys.stderr = self._save_stderr logger.info("restore done") - def _atexit_cleanup(self): + def _atexit_cleanup(self, exit_code=None): if self._backend is None: logger.warning("process exited without backend configured") return False @@ -693,7 +693,7 @@ def _atexit_cleanup(self): return self._atexit_cleanup_called = True - exit_code = self._hooks.exit_code if self._hooks else 0 + exit_code = exit_code or self._hooks.exit_code if self._hooks else 0 logger.info("got exitcode: %d", exit_code) ret = self._backend.interface.send_exit_sync(exit_code, timeout=60) logger.info("got exit ret: %s", ret) diff --git a/wandb/sdk_py27/wandb_run.py b/wandb/sdk_py27/wandb_run.py index 366a4a18..ffd845aa 100644 --- a/wandb/sdk_py27/wandb_run.py +++ b/wandb/sdk_py27/wandb_run.py @@ -572,12 +572,12 @@ def restore( return None return files[0].download(root=root, replace=True) - def join(self): + def join(self, exit_code=None): """Marks a run as finished, and finishes uploading all data. This is used when creating multiple runs in the same process. We automatically call this method when your script exits. """ - self._atexit_cleanup() + self._atexit_cleanup(exit_code=exit_code) if len(self._wl._global_run_stack) > 0: self._wl._global_run_stack.pop() @@ -685,7 +685,7 @@ def _restore(self): sys.stderr = self._save_stderr logger.info("restore done") - def _atexit_cleanup(self): + def _atexit_cleanup(self, exit_code=None): if self._backend is None: logger.warning("process exited without backend configured") return False @@ -693,7 +693,7 @@ def _atexit_cleanup(self): return self._atexit_cleanup_called = True - exit_code = self._hooks.exit_code if self._hooks else 0 + exit_code = exit_code or self._hooks.exit_code if self._hooks else 0 logger.info("got exitcode: %d", exit_code) ret = self._backend.interface.send_exit_sync(exit_code, timeout=60) logger.info("got exit ret: %s", ret)