summaryrefslogtreecommitdiffstats
path: root/wallace/module_resources.py
diff options
context:
space:
mode:
authorLiutauras Adomaitis <adomaitis@kolabsystems.com>2019-08-16 13:56:23 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-08-16 13:56:23 +0200
commit775aa79262cace87c2443475c11abb9e5b609fe4 (patch)
tree86be8e4251e9855abb22ae00f7ccf8446d0ec9cb /wallace/module_resources.py
parent88a6fa3f29f9bd937186f9dceb8d880b8af7692b (diff)
downloadpykolab-775aa79262cace87c2443475c11abb9e5b609fe4.tar.gz
More logging in Wallace and --max-tasks per process option for wallaced
Summary: Given that part of https://git.kolab.org/D761 changes are obsolete after commit baeee0049f06430801a2d9940f875747e51be7f5 I still want to have some changes find their way in master. Test Plan: None Reviewers: vanmeeuwen Subscribers: petersen, machniak, vanmeeuwen Differential Revision: https://git.kolab.org/D791
Diffstat (limited to 'wallace/module_resources.py')
-rw-r--r--wallace/module_resources.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index 93d0b4e..c0e9613 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -66,7 +66,10 @@ policy_name_map = {
'ACT_ACCEPT_AND_NOTIFY': ACT_ACCEPT_AND_NOTIFY
}
-log = pykolab.getLogger('pykolab.wallace')
+log = pykolab.getLogger('pykolab.wallace/resources')
+extra_log_params = {'qid': '-'}
+log = pykolab.logger.LoggerAdapter(log, extra_log_params)
+
conf = pykolab.getConf()
mybasepath = '/var/spool/pykolab/wallace/resources/'
@@ -93,10 +96,12 @@ def description():
return """Resource management module."""
def cleanup():
- global auth, imap
+ global auth, imap, extra_log_params
log.debug("cleanup(): %r, %r" % (auth, imap), level=8)
+ extra_log_params['qid'] = '-'
+
auth.disconnect()
del auth
@@ -105,7 +110,12 @@ def cleanup():
del imap
def execute(*args, **kw):
- global auth, imap
+ global auth, imap, extra_log_params
+
+ # TODO: Test for correct call.
+ filepath = args[0]
+
+ extra_log_params['qid'] = os.path.basename(filepath)
# (re)set language to default
pykolab.translate.setUserLanguage(conf.get('kolab','default_locale'))
@@ -122,9 +132,6 @@ def execute(*args, **kw):
auth = Auth()
imap = IMAP()
- # TODO: Test for correct call.
- filepath = args[0]
-
if kw.has_key('stage'):
log.debug(
_("Issuing callback after processing to stage %s") % (