@@ -50,7 +50,12 @@ class ResQ(object):
5050 >>> r = ResQ(server="192.168.1.10:6379", password="some_pwd")
5151 # Assuming redis is running on default port with no password
5252
53-
53+ **r** is a resque object on which we can enqueue tasks.::
54+
55+ >>>> r.enqueue(SomeClass, args)
56+
57+ SomeClass can be any python class with *perform* method and a *queue*
58+ attribute on it.
5459 """
5560 def __init__ (self , server = "localhost:6379" , password = None ,
5661 timeout = None , retry_connection = True ):
@@ -109,6 +114,10 @@ def _set_redis(self, server):
109114 redis = property (_get_redis , _set_redis )
110115
111116 def enqueue (self , klass , * args ):
117+ """
118+ Enqueue a job into a specific queue. Make sure the class you are passing
119+ has **queue** attribute and a **perform** method on it.
120+ """
112121 queue = getattr (klass ,'queue' , None )
113122 #print cls._res
114123 if queue :
@@ -123,6 +132,10 @@ def queues(self):
123132 return self .redis .smembers ("resque:queues" )
124133
125134 def info (self ):
135+ """
136+ Returns a dictionary of the current status of the pending jobs,
137+ processed, no. of queues, no. of workers, no. of failed jobs.
138+ """
126139 pending = 0
127140 for q in self .queues ():
128141 pending += self .size (q )
@@ -183,6 +196,9 @@ def _enqueue(cls, klass, *args):
183196 #Job.create(queue, klass,*args)
184197
185198class Stat (object ):
199+ """
200+ A Stat class which shows the current status of the queue.
201+ """
186202 def __init__ (self , name , resq ):
187203 self .name = name
188204 self .key = "resque:stat:%s" % self .name
0 commit comments