summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/conf.py20
-rw-r--r--gear/__init__.py43
2 files changed, 33 insertions, 30 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index a0880b6..9f05b93 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -41,8 +41,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'Gear'
-copyright = u'2013, OpenStack Foundation'
+project = 'Gear'
+copyright = '2013, OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -184,8 +184,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'Gear.tex', u'Gear Documentation',
- u'OpenStack Foundation', 'manual'),
+ ('index', 'Gear.tex', 'Gear Documentation',
+ 'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -214,10 +214,10 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'gear', u'Gear Full Documentation',
- [u'OpenStack Foundation'], 1),
- ('geard', 'geard', u'async pure python Gearman daemon',
- [u'OpenStack Foundation'], 8),
+ ('index', 'gear', 'Gear Full Documentation',
+ ['OpenStack Foundation'], 1),
+ ('geard', 'geard', 'async pure python Gearman daemon',
+ ['OpenStack Foundation'], 8),
]
# If true, show URL addresses after external links.
@@ -230,8 +230,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'Gear', u'Gear Documentation',
- u'OpenStack Foundation', 'Gear', 'One line description of project.',
+ ('index', 'Gear', 'Gear Documentation',
+ 'OpenStack Foundation', 'Gear', 'One line description of project.',
'Miscellaneous'),
]
diff --git a/gear/__init__.py b/gear/__init__.py
index 4a0fcb7..6287281 100644
--- a/gear/__init__.py
+++ b/gear/__init__.py
@@ -997,6 +997,17 @@ class BaseClientServer(object):
end = time.time()
self.reportTimingStats(packet.ptype, end - start)
+ def handleDisconnect(self, job):
+ """Handle a Gearman server disconnection.
+
+ If the Gearman server is disconnected, this will be called for any
+ jobs currently associated with the server.
+
+ :arg Job packet: The :py:class:`Job` that was running when the server
+ disconnected.
+ """
+ return job
+
def reportTimingStats(self, ptype, duration):
"""Report processing times by packet type
@@ -1251,15 +1262,18 @@ class BaseClient(BaseClientServer):
start_time = time.time()
while self.running:
self.connections_condition.acquire()
- while self.running and not self.active_connections:
- if timeout is not None:
- self._checkTimeout(start_time, timeout)
- self.log.debug("Waiting for at least one active connection")
- self.connections_condition.wait(timeout=1)
- if self.active_connections:
- self.log.debug("Active connection found")
- connected = True
- self.connections_condition.release()
+ try:
+ while self.running and not self.active_connections:
+ if timeout is not None:
+ self._checkTimeout(start_time, timeout)
+ self.log.debug("Waiting for at least one active "
+ "connection")
+ self.connections_condition.wait(timeout=1)
+ if self.active_connections:
+ self.log.debug("Active connection found")
+ connected = True
+ finally:
+ self.connections_condition.release()
if connected:
return
@@ -1697,17 +1711,6 @@ class Client(BaseClient):
packet.connection.handleOptionRes(packet.getArgument(0))
task.setComplete()
- def handleDisconnect(self, job):
- """Handle a Gearman server disconnection.
-
- If the Gearman server is disconnected, this will be called for any
- jobs currently associated with the server.
-
- :arg Job packet: The :py:class:`Job` that was running when the server
- disconnected.
- """
- return job
-
class FunctionRecord(object):
"""Represents a function that should be registered with Gearman.