diff options
author | martinko | 2012-10-19 10:32:29 +0000 |
---|---|---|
committer | martinko | 2012-10-19 10:32:29 +0000 |
commit | 784496248a7eaecea2e9cc6dad1d62dd30dccb15 (patch) | |
tree | cbf5cc2fc6b83bd951401318044bc09d866a8dbd /python/skytools/scripting.py | |
parent | a777d9662e979498d1a5bf5b47c3e97a0c80407d (diff) |
skytools.scripting: added start-up time attribute
Diffstat (limited to 'python/skytools/scripting.py')
-rw-r--r-- | python/skytools/scripting.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index 004cacfb..aba4842d 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -456,6 +456,14 @@ class BaseScript(object): sys.exit(1) self.last_sigint = t + def stat_get(self, key): + """Reads a stat value.""" + try: + value = self.stat_dict[key] + except KeyError: + value = None + return value + def stat_put(self, key, value): """Sets a stat value.""" self.stat_dict[key] = value @@ -597,6 +605,7 @@ class BaseScript(object): In case of daemon, if will be called in same process as work(), unlike __init__(). """ + self.started = time.time() # set signals if hasattr(signal, 'SIGHUP'): |