From a777d9662e979498d1a5bf5b47c3e97a0c80407d Mon Sep 17 00:00:00 2001 From: martinko Date: Fri, 19 Oct 2012 12:19:28 +0200 Subject: white noise --- python/skytools/scripting.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'python/skytools/scripting.py') diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index 12a72da9..004cacfb 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -249,7 +249,7 @@ class BaseScript(object): @param service_name: unique name for script. It will be also default job_name, if not specified in config. - @param args: cmdline args (sys.argv[1:]), but can be overrided + @param args: cmdline args (sys.argv[1:]), but can be overridden """ self.service_name = service_name self.go_daemon = 0 @@ -339,7 +339,7 @@ class BaseScript(object): """Loads and returns skytools.Config instance. By default it uses first command-line argument as config - file name. Can be overrided. + file name. Can be overridden. """ if len(self.args) < 1: @@ -354,7 +354,7 @@ class BaseScript(object): """Initialize a OptionParser() instance that will be used to parse command line arguments. - Note that it can be overrided both directions - either DBScript + Note that it can be overridden both directions - either DBScript will initialize a instance and passes to user code or user can initialize and then pass to DBScript.init_optparse(). @@ -647,7 +647,7 @@ class DBScript(BaseScript): @param service_name: unique name for script. It will be also default job_name, if not specified in config. - @param args: cmdline args (sys.argv[1:]), but can be overrided + @param args: cmdline args (sys.argv[1:]), but can be overridden """ self.db_cache = {} self._db_defaults = {} @@ -873,7 +873,6 @@ class DBScript(BaseScript): # error is already logged sys.exit(1) - def listen(self, dbname, channel): """Make connection listen for specific event channel. -- cgit v1.2.3 From 784496248a7eaecea2e9cc6dad1d62dd30dccb15 Mon Sep 17 00:00:00 2001 From: martinko Date: Fri, 19 Oct 2012 12:32:29 +0200 Subject: skytools.scripting: added start-up time attribute --- python/skytools/scripting.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/skytools/scripting.py') 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'): -- cgit v1.2.3