[dvsim] Cosmetic updates to launcher methods
- Rearranged APIs to make them uniform
- Updated `_has_passed()`
- Renamed to `_check_status()`
- Returns a tuple as opposed to bool
- Tuple returned is status, err_msg, where status is "P" or "F"
- Makes it easy to pick the 'right' error message to report
especially when there are multiple points of failure in more complex
launcher system such as LSF
- _post_finish() now takes err_msg as additional arg to reuse more code
- LsfLauncher:
- Renamed some vars / methods
- Removed the bsub output file existence check since it adds runtime
overhead and is not needed.
- Some more cosmetic changes
Signed-off-by: Srikrishna Iyer <sriyer@google.com>
diff --git a/util/dvsim/LocalLauncher.py b/util/dvsim/LocalLauncher.py
index c93e966..bf6c8f5 100644
--- a/util/dvsim/LocalLauncher.py
+++ b/util/dvsim/LocalLauncher.py
@@ -79,16 +79,10 @@
return 'D'
self.exit_code = self.process.returncode
- status = 'P' if self._has_passed() else 'F'
-
- self._post_finish(status)
+ status, err_msg = self._check_status()
+ self._post_finish(status, err_msg)
return status
- def _post_finish(self, status):
- super()._post_finish(status)
- self._close_process()
- self.process = None
-
def kill(self):
'''Kill the running process.
@@ -106,7 +100,12 @@
except subprocess.TimeoutExpired:
self.process.kill()
- self._post_finish('K')
+ self._post_finish('K', 'Job killed!')
+
+ def _post_finish(self, status, err_msg):
+ super()._post_finish(status, err_msg)
+ self._close_process()
+ self.process = None
def _close_process(self):
'''Close the file descriptors associated with the process.'''