Skip to content

Commit 425612c

Browse files
author
Matt George
committed
fixed my screwed up commit
1 parent 4017254 commit 425612c

File tree

17 files changed

+527
-207
lines changed

17 files changed

+527
-207
lines changed

_sources/class.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,25 @@ ResQ Classes
44
==========================================
55

66
.. autoclass:: pyres.ResQ
7+
:members:
8+
9+
Job Classes
10+
=================
11+
12+
.. autoclass:: pyres.job.Job
13+
:members:
14+
15+
Worker Classes
16+
=================
17+
18+
.. autoclass:: pyres.worker.Worker
19+
:members:
20+
21+
Failure Classes
22+
=================
23+
24+
.. autoclass:: pyres.failure.base.BaseBackend
25+
:members:
26+
27+
.. autoclass:: pyres.failure.RedisBackend
28+
:members:

_sources/example.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
=========
2-
EXAMPLE
1+
Example
32
=========
43

54
Let's take a real wold example of a blog where comments need to be checked for
6-
spam check. When the comment is saved in the database, we create a job in the
7-
queue with comment data. Let's take a django model in this case.::
5+
spam. When the comment is saved in the database, we create a job in the
6+
queue with that comment data. Let's take a django model in this case.
7+
8+
.. code-block:: python
9+
:linenos:
810

911
class Comment(models.Model):
1012
name = Model.CharField()
@@ -27,14 +29,14 @@ queue with comment data. Let's take a django model in this case.::
2729
comment.spam = False
2830
comment.save()
2931

30-
You can convert your existing class to be compatible with Pyres. All you need
31-
to do is add a @queue@ variable and define a @perform@ method on the class.
32+
You can convert your existing class to be compatible with pyres. All you need
33+
to do is add a :attr:`queue` attribute and define a :meth:`perform` method on the class.
3234

33-
To insert a job into the queue you need to do something like this:::
35+
To insert a job into the queue you need to do something like this::
3436

35-
from pyres import ResQ
36-
r = Resq()
37-
r.enqueue(Spam, 23) # Passing the comment id 23
37+
>>> from pyres import ResQ
38+
>>> r = Resq()
39+
>>> r.enqueue(Spam, 23) # Passing the comment id 23
3840

3941
This puts a job into the queue **Spam**. Now we need to fire off our workers.
4042
In the **scripts** folder there is an executable::

_sources/index.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
.. PyRes documentation master file, created by
1+
.. pyres documentation master file, created by
22
sphinx-quickstart on Wed Jan 6 15:11:19 2010.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55

6-
Welcome to PyRes's documentation!
6+
Welcome to pyres's documentation!
77
=================================
88

99
Contents:
1010

1111
.. toctree::
12-
:maxdepth: 2
12+
:maxdepth: 2
13+
14+
intro
15+
install
16+
example
17+
class
18+
tests
19+
failures
1320

14-
intro
15-
install
16-
example
17-
class
18-
tests
1921

2022
Indices and tables
2123
==================

_sources/install.txt

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
Installation
22
===============
33

4-
Requirements:
5-
--------------
6-
simplejson>=2.0.9
7-
itty>=0.6.2
8-
redis>=0.6.0
9-
pystache>=0.1.0
4+
Pyres is most easily installed using pip and can be found on PyPI as pyres_.
105

11-
Make sure you install these requirements before proceeding.
6+
Using ``pip install pyres`` will install the required versions of the above packages/modules.
7+
Those requirements are currently:
128

13-
.. todo:: Need to point to notes on redis installation and get python-redis.
9+
::
1410

15-
16-
To install pyres.::
11+
simplejson==2.0.9
12+
itty==0.6.4
13+
redis==1.34.1
14+
pystache==0.2.0
15+
16+
If you'd rather install from the git repository, that's easy too::
1717

1818
$ git clone git://github.com/binarydud/pyres.git
1919
$ cd pyres
2020
$ python setup.py build
2121
$ python setup.py install
2222

23-
Might need to run as sudo to install.
23+
Of course, you'll need to install the Redis server as well. Below is a simple example, but
24+
please read `Redis's own documentation`_ for more details.
25+
26+
::
27+
28+
$ wget http://redis.googlecode.com/files/redis-1.2.2.tar.gz
29+
$ tar -xvf redis-1.2.2.tar.gz
30+
$ cd redis-1.2.2
31+
$ make
32+
$ ./redis-server
33+
34+
This will install and start a Redis server with the default config running on port 6379.
35+
This default config is good enough for you to run the pyres tests.
36+
37+
.. _pyres: http://pypi.python.org/pypi/pyres/
38+
.. _Redis's own documentation: http://code.google.com/p/redis/wiki/index?tm=6
2439

2540

2641

_sources/intro.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
Introduction
22
============
33

4-
PyRes is a resque_ clone built in python. Resque is used by Github as their
5-
message queue. Read_ the blog post from github about how they use resque in
6-
production.
7-
8-
:synopsis: Any job which takes a little while to run can be put on a message
9-
queue. Read our :doc:`Example </example>` implementation of how a PyRes can be used to spam
10-
check comments.
4+
Pyres is a resque_ clone built in python. Resque is used by Github as their
5+
message queue. Both use Redis_ as the queue backend and provide a web-based
6+
monitoring application.
117

8+
Read_ the blog post from github about how they use resque in production.
129

10+
:synopsis: Put jobs (which can be any kind of class) on a queue and process them while watching the progress via your browser.
1311

12+
Read our :doc:`example implementation </example>` of how pyres can be used to spam check comments.
1413

1514

1615
.. _resque: http://github.com/defunkt/resque#readme
1716
.. _Read: http://github.com/blog/542-introducing-resque
18-
17+
.. _Redis: http://code.google.com/p/redis/

_sources/tests.txt

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
Tests
22
=======
33

4-
PyRes comes with a test suite which connects to a local redis server and
5-
creates a couple of *Queues* and *jobs*.
4+
Pyres comes with a test suite which connects to a local Redis server and
5+
creates a couple of *queues* and *jobs*.
66

7-
To run tests make sure you have nose_ installed.::
7+
Make sure you have nose_ installed::
88

9-
$ easy_install nose
10-
$ redis-server [PATH_TO_YOUR_REDIS_CONFIG]
11-
$ nosetests
9+
$ pip install nose
10+
11+
Also make sure your Redis server is running::
12+
13+
$ cd path_to_redis_installation
14+
$ ./redis-server [PATH_TO_YOUR_REDIS_CONFIG]
15+
16+
If you don't give the ``./redis-server`` command the config path, it will use a default config, which should run the tests just fine.
17+
18+
Now, we're ready to run the tests. From the pyres install directory::
19+
20+
$ nosetests
21+
............................................
22+
----------------------------------------------------------------------
23+
Ran 44 tests in 0.901s
24+
25+
OK
1226

1327
Add **-v** flag if you want verbose output.
1428

0 commit comments

Comments
 (0)