Skip to content

Commit af85edf

Browse files
author
Matt George
committed
Merge remote branch 'yashh/gh-pages' into gh-pages
2 parents 536aa33 + 6e2d161 commit af85edf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+5757
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc

.nojekyll

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
==============
2+
How To Install
3+
==============
4+
5+
Install in Sphinx
6+
-----------------
7+
8+
Copy this directory into the ``sphinx/templates`` directory where Shpinx is installed. For example, a standard install of sphinx on Mac OS X is at ``/Library/Python/2.6/site-packages/Sphinx-0.6.3-py2.6.egg/``
9+
10+
Install Somewhere Else
11+
----------------------
12+
13+
If you want to install this theme somewhere else, you will have to modify the ``conf.py`` file. ::
14+
15+
templates_path = ['/absolute/path/to/dir/','relative/path/']
16+
17+
Making Sphinx Use the Theme
18+
---------------------------
19+
20+
Edit the ``conf.py`` file and make the following setting: ::
21+
22+
html_theme = 'ADCtheme'
23+
24+
Screen Shots
25+
------------
26+
27+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn1.png
28+
29+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn2.png
30+
31+
To Do
32+
-----
33+
34+
* Gotta get the javascript working so the Table of Contents is hide-able.
35+
* Probably lots of css cleanup.

_sources/class.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. module:: pyres
2+
3+
ResQ Classes
4+
==========================================
5+
6+
.. autoclass:: pyres.ResQ
7+
:members:
8+
9+
10+
Job Classes
11+
=================
12+
13+
.. autoclass:: pyres.job.Job
14+
:members:
15+
16+
Worker Classes
17+
=================
18+
19+
.. autoclass:: pyres.worker.Worker
20+
:members:

_sources/example.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
=========
2+
EXAMPLE
3+
=========
4+
5+
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.
8+
9+
.. code-block:: python
10+
:linenos:
11+
12+
class Comment(models.Model):
13+
name = Model.CharField()
14+
email = Model.EmailField()
15+
body = Model.TextField()
16+
spam = Model.BooleanField()
17+
queue = "Spam"
18+
19+
@staticmethod
20+
def perform(comment_id):
21+
comment = Comment.objects.get(pk=comment_id)
22+
params = {"comment_author_email": comment.user.email,
23+
"comment_content": comment.body,
24+
"comment_author_name": comment.user.name,
25+
"request_ip": comment.author_ip}
26+
x = urllib.urlopen("http://apikey.rest.akismet.com/1.1/comment-check", params)
27+
if x == "true":
28+
comment.spam = True
29+
else:
30+
comment.spam = False
31+
comment.save()
32+
33+
You can convert your existing class to be compatible with Pyres. All you need
34+
to do is add a @queue@ variable and define a @perform@ method on the class.
35+
36+
To insert a job into the queue you need to do something like this:::
37+
38+
from pyres import ResQ
39+
r = Resq()
40+
r.enqueue(Spam, 23) # Passing the comment id 23
41+
42+
This puts a job into the queue **Spam**. Now we need to fire off our workers.
43+
In the **scripts** folder there is an executable::
44+
45+
$ ./pyres_worker Spam
46+
47+
48+
Just pass a comma separated list of queues the worker should poll.
49+
50+

_sources/index.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. PyRes documentation master file, created by
2+
sphinx-quickstart on Wed Jan 6 15:11:19 2010.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to PyRes's documentation!
7+
=================================
8+
9+
Contents:
10+
11+
.. toctree::
12+
:maxdepth: 2
13+
14+
intro
15+
install
16+
example
17+
class
18+
tests
19+
20+
Indices and tables
21+
==================
22+
23+
* :ref:`genindex`
24+
* :ref:`modindex`
25+
* :ref:`search`
26+

_sources/install.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Installation
2+
===============
3+
4+
Requirements:
5+
--------------
6+
simplejson>=2.0.9
7+
itty>=0.6.2
8+
redis>=0.6.0
9+
pystache>=0.1.0
10+
11+
Make sure you install these requirements before proceeding.
12+
13+
.. todo:: Need to point to notes on redis installation and get python-redis.
14+
15+
16+
To install pyres.::
17+
18+
$ git clone git://github.com/binarydud/pyres.git
19+
$ cd pyres
20+
$ python setup.py build
21+
$ python setup.py install
22+
23+
Might need to run as sudo to install.
24+
25+
26+

_sources/intro.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Introduction
2+
============
3+
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 check comments.
10+
11+
12+
.. _resque: http://github.com/defunkt/resque#readme
13+
.. _Read: http://github.com/blog/542-introducing-resque
14+

_sources/tests.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Tests
2+
=======
3+
4+
PyRes comes with a test suite which connects to a local redis server and
5+
creates a couple of *Queues* and *jobs*.
6+
7+
To run tests make sure you have nose_ installed.::
8+
9+
$ easy_install nose
10+
$ redis-server [PATH_TO_YOUR_REDIS_CONFIG]
11+
$ nosetests
12+
13+
Add **-v** flag if you want verbose output.
14+
15+
.. _nose: http://somethingaboutorange.com/mrl/projects/nose/0.11.1/

0 commit comments

Comments
 (0)