Permalink
Browse files

Rename worker.context to worker.job_context

  • Loading branch information...
1 parent e924d72 commit c13fc4091870a5cd4052a961e6e864365a87defe @hannosch hannosch committed Apr 2, 2012
Showing with 13 additions and 13 deletions.
  1. +4 −4 docs/config.rst
  2. +1 −1 docs/index.rst
  3. +1 −1 qdo/config.py
  4. +1 −1 qdo/tests/test_worker.py
  5. +6 −6 qdo/worker.py
View
@@ -26,14 +26,14 @@ ca_bundle
Path to a private certificate used for SSL connections, in addition to all
officially signed ones.
-context
- The :term:`resource specification` for a Python job context (manager).
- For example: `qdo.worker:dict_context`
-
job
The :term:`resource specification` for the Python job function. For
example: `qdo.testing:example_job`
+job_context
+ The :term:`resource specification` for a Python job context (manager).
+ For example: `qdo.worker:dict_context`
+
[queuey]
--------
View
@@ -41,8 +41,8 @@ And one config file named `hello.conf`:
.. code-block:: ini
[qdo-worker]
- context = hello:job_context
job = hello:job
+ job_context = hello:job_context
[zookeeper]
connection = 127.0.0.1:2181/hello
View
@@ -20,8 +20,8 @@ def load_defaults(self):
"""Populate settings with default values"""
self[u'qdo-worker.wait_interval'] = 5
self[u'qdo-worker.ca_bundle'] = None
- self[u'qdo-worker.context'] = u'qdo.worker:dict_context'
self[u'qdo-worker.job'] = None
+ self[u'qdo-worker.job_context'] = u'qdo.worker:dict_context'
self[u'queuey.connection'] = u'https://127.0.0.1:5001/v1/queuey/'
self[u'queuey.app_key'] = None
View
@@ -136,8 +136,8 @@ def job(context, message):
if message[u'body'] == u'end':
raise KeyboardInterrupt
- worker.context = job_context
worker.job = job
+ worker.job_context = job_context
self._post_message(u'work')
self._post_message(u'end')
View
@@ -40,8 +40,8 @@ def __init__(self, settings):
self.name = u'%s-%s' % (socket.getfqdn(), os.getpid())
self.zk_conn = None
self.zk_node = None
- self.context = dict_context
self.job = None
+ self.job_context = dict_context
self.partitions = {}
self.configure()
@@ -50,14 +50,14 @@ def configure(self):
"""
qdo_section = self.settings.getsection(u'qdo-worker')
self.wait_interval = qdo_section[u'wait_interval']
- if qdo_section[u'context']:
- mod, fun = qdo_section[u'context'].split(u':')
- result = __import__(mod, globals(), locals(), fun)
- self.context = getattr(result, fun)
if qdo_section[u'job']:
mod, fun = qdo_section[u'job'].split(u':')
result = __import__(mod, globals(), locals(), fun)
self.job = getattr(result, fun)
+ if qdo_section[u'job_context']:
+ mod, fun = qdo_section[u'job_context'].split(u':')
+ result = __import__(mod, globals(), locals(), fun)
+ self.job_context = getattr(result, fun)
zk_section = self.settings.getsection(u'zookeeper')
self.zk_root_url = zk_section[u'connection']
queuey_section = self.settings.getsection(u'queuey')
@@ -115,7 +115,7 @@ def work(self):
self.setup_zookeeper()
self.register()
try:
- with self.context() as context:
+ with self.job_context() as context:
while 1:
if self.shutdown:
break

0 comments on commit c13fc40

Please sign in to comment.