Skip to content
Snippets Groups Projects
Commit e63014b3 authored by lukas leufen's avatar lukas leufen
Browse files

TimeTracking can be used by the with statement to easily measure time spent

parent 3e7939da
No related branches found
No related tags found
2 merge requests!37include new development,!30Lukas issue037 feat run without training
Pipeline #29019 passed with warnings
......@@ -88,6 +88,13 @@ class TimeTracking(object):
def duration(self):
return self._duration()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.stop()
logging.info(f"undefined job finished after {self}")
def prepare_host(create_new=True):
hostname = socket.gethostname()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment