Permalink
Browse files

Documentation touchups

  • Loading branch information...
1 parent 46faddd commit fb73bf02d5196ec49ee59d9cd31107f3c8fed6df Matthew Tai committed Sep 28, 2010
Showing with 75 additions and 61 deletions.
  1. +2 −1 AUTHORS.txt
  2. +2 −1 CHANGES.txt
  3. +0 −25 README.rst
  4. +22 −0 README.txt
  5. +4 −0 TODO.txt
  6. +22 −21 docs/client.rst
  7. +2 −2 docs/job.rst
  8. +1 −1 gearman/__init__.py
  9. +2 −1 gearman/admin_client.py
  10. +2 −5 gearman/worker.py
  11. +8 −0 setup.cfg
  12. +8 −4 setup.py
View
@@ -4,8 +4,9 @@ Primary authors:
* Matthew Tai <mtai@yelp.com>
-Contributors:
+Contributors (in order of contribution, latest first):
+* Khaled alHabache <khellls@gmail.com> :: python 2.4 backward compatibility
* Eskil Olsen <eskil@yelp.com> :: Connection fixes
* Julian Krause <juliank@yelp.com> :: Architectural design
View
@@ -1 +1,2 @@
-v2.0.0, 2010-06-15 -- Initial release
+v2.0.0, 2010-09-28 -- Initial release
+v2.0.0.beta, 2010-06-15 -- Beta release
View
@@ -1,25 +0,0 @@
-==============
-python-gearman
-==============
-
-Description
-===========
-Python Gearman API - Client, worker, and admin client interfaces
-
-For information on the Gearman protocol and a Gearman server, see http://www.gearman.org/
-
-Installation
-============
-Work in progress
-
-Status
-======
-2.0.0 - Beta build, in testing
-
-Links
-=====
-* `2.x source <http://github.com/Yelp/python-gearman/>`_
-* `2.x documentation <http://github.com/Yelp/python-gearman/tree/master/docs/>`_
-
-* `1.x source <http://github.com/samuel/python-gearman/>`_
-* `1.x documentation <http://github.com/samuel/python-gearman/tree/master/docs/>`_
View
@@ -0,0 +1,22 @@
+==============
+python-gearman
+==============
+
+Description
+===========
+Python Gearman API - Client, worker, and admin client interfaces
+
+For information on Gearman and a C-based Gearman server, see http://www.gearman.org/
+
+Installation
+============
+* easy_install gearman
+* pip install gearman
+
+Links
+=====
+* 2.x source <http://github.com/Yelp/python-gearman/>
+* 2.x documentation <http://packages.python.org/gearman/>
+
+* 1.x source <http://github.com/samuel/python-gearman/>
+* 1.x documentation <http://github.com/samuel/python-gearman/tree/master/docs/>
View
@@ -0,0 +1,4 @@
+Requested features (contributions welcome)
+==========================================
+* Update ConnectionManager code to play well with Twisted
+* Update Worker to handle multiple jobs at once instead of processing one at a time
View
@@ -5,7 +5,7 @@
Function available to all examples::
- def check_request_status(job_request)
+ def check_request_status(job_request):
if job_request.complete:
print "Job %s finished! Result: %s - %s" % (job_request.job.unique, job_request.state, job_request.result)
elif job_request.timed_out:
@@ -54,7 +54,7 @@ Submitting jobs
# Wait at most 5 seconds before timing out incomplete requests
completed_requests = gm_client.wait_until_jobs_completed(submitted_requests, poll_timeout=5.0)
- for completed_job_request in completed_results:
+ for completed_job_request in completed_requests:
check_request_status(completed_job_request)
@@ -93,27 +93,28 @@ Extending the client
--------------------
.. autoattribute:: GearmanClient.data_encoder
- Send/receive Python objects (not just byte strings)::
+Send/receive Python objects (not just byte strings)::
- # By default, GearmanClient's can only send off byte-strings
- # If we want to be able to send out Python objects, we can specify a data encoder
- # This will automatically convert byte strings <-> Python objects for ALL commands that have the 'data' field
- #
- # See http://gearman.org/index.php?id=protocol for client commands that send/receive 'opaque data'
- #
- import cPickle as pickle
+ # By default, GearmanClient's can only send off byte-strings
+ # If we want to be able to send out Python objects, we can specify a data encoder
+ # This will automatically convert byte strings <-> Python objects for ALL commands that have the 'data' field
+ #
+ # See http://gearman.org/index.php?id=protocol for client commands that send/receive 'opaque data'
+ import pickle
- class PickleDataEncoder(gearman.DataEncoder)
- @classmethod
- def encode(cls, encodable_object):
- return pickle.dumps(encodable_object)
+ class PickleDataEncoder(gearman.DataEncoder):
+ @classmethod
+ def encode(cls, encodable_object):
+ return pickle.dumps(encodable_object)
- @classmethod
- def decode(cls, decodable_string):
- return pickle.loads(decodable_string)
+ @classmethod
+ def decode(cls, decodable_string):
+ return pickle.loads(decodable_string)
- class PickleExampleClient(gearman.GearmanClient):
- data_encoder = PickleDataEncoder
+ class PickleExampleClient(gearman.GearmanClient):
+ data_encoder = PickleDataEncoder
- gm_client = PickleExampleClient(['localhost:4730'])
- gm_client.submit_job("task_name", <Python object to be pickled>)
+ my_python_object = {'hello': 'there'}
+
+ gm_client = PickleExampleClient(['localhost:4730'])
+ gm_client.submit_job("task_name", my_python_object)
View
@@ -63,7 +63,7 @@ Tracking job progress
^^^^^^^^^^^^^^^^^^^^^
.. attribute:: GearmanJobRequest.result
- :const:`binary` - Job's returned binary payload
+ :const:`binary` - Job's returned binary payload - Populated if and only if JOB_COMPLETE
.. attribute:: GearmanJobRequest.exception
@@ -87,7 +87,7 @@ Tracking job progress
Tracking in-flight job updates
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Certain GearmanJob's may send back data prior to actually completing. :const:`GearmanClient` uses these queues to keep track of what/when we received certain updates.k
+Certain GearmanJob's may send back data prior to actually completing. :const:`GearmanClient` uses these queues to keep track of what/when we received certain updates.
.. attribute:: GearmanJobRequest.warning_updates
View
@@ -2,7 +2,7 @@
Gearman API - Client, worker, and admin client interfaces
"""
-__version__ = '2.0.0.beta'
+__version__ = '2.0.0'
from gearman.admin_client import GearmanAdminClient
from gearman.client import GearmanClient
View
@@ -16,7 +16,8 @@
DEFAULT_ADMIN_CLIENT_TIMEOUT = 10.0
class GearmanAdminClient(GearmanConnectionManager):
- """Connects to a single server and sends TEXT based administrative commands.
+ """GearmanAdminClient :: Interface to send/receive administrative commands to a Gearman server
+
This client acts as a BLOCKING client and each call will poll until it receives a satisfactory server response
http://gearman.org/index.php?id=protocol
View
@@ -11,11 +11,8 @@
POLL_TIMEOUT_IN_SECONDS = 60.0
class GearmanWorker(GearmanConnectionManager):
- """GearmanWorkers manage connections and CommandHandlers
-
- * Public facing gearman interface that most users should be instantiating
- * All I/O will be handled by the GearmanWorker
- * All state machine operations are handled on the CommandHandler
+ """
+ GearmanWorker :: Interface to accept jobs from a Gearman server
"""
command_handler_class = GearmanWorkerCommandHandler
View
@@ -0,0 +1,8 @@
+[build_sphinx]
+source-dir = docs/
+build-dir = docs/_build
+all_files = 1
+
+[upload_sphinx]
+upload-dir = docs/_build/html
+
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from distutils.core import setup
+from setuptools import setup
from gearman import __version__ as version
@@ -10,17 +10,21 @@
author = 'Matthew Tai',
author_email = 'mtai@yelp.com',
description = 'Gearman API - Client, worker, and admin client interfaces',
- long_description=open('README.rst').read(),
+ long_description=open('README.txt').read(),
url = 'http://github.com/Yelp/python-gearman/',
packages = ['gearman'],
- license='LICENSE.txt',
+ license='Apache',
classifiers = [
- 'Development Status :: 4 - Beta',
+ 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.4',
+ 'Programming Language :: Python :: 2.5',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)

0 comments on commit fb73bf0

Please sign in to comment.