about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-28 17:38:40 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-28 17:38:40 +0200
commitc4cad6af5552ca08c512f47399c6ca7c888f2c50 (patch)
tree14168f2b149ace7fada1fb6f8bdca99a5300de66
parentdefault batch size is 10; delete from jobs from uniq (diff)
downloadpresque-c4cad6af5552ca08c512f47399c6ca7c888f2c50.tar.gz
update POD
-rw-r--r--lib/presque/ControlHandler.pm30
-rw-r--r--lib/presque/JobQueueHandler.pm27
-rw-r--r--lib/presque/StatusHandler.pm34
-rw-r--r--lib/presque/WorkerHandler.pm13
4 files changed, 90 insertions, 14 deletions
diff --git a/lib/presque/ControlHandler.pm b/lib/presque/ControlHandler.pm
index 998d55c..ee48ef6 100644
--- a/lib/presque/ControlHandler.pm
+++ b/lib/presque/ControlHandler.pm
@@ -72,13 +72,13 @@ presque::ControlHandler
 =head1 SYNOPSIS
 
     # stop a queue
-    curl -X POST -H 'Content-Type: application/json' -d '{"status":"stop"}' http://localhost:5000/control/queuename
+    curl -X POST -H 'Content-Type: application/json' -d '{"status":"stop"}' http://localhost:5000/control/:queue_name
 
     # start a queue
-    curl -X POST -H 'Content-Type: application/json' -d '{"status":"start"}' http://localhost:5000/control/queuename
+    curl -X POST -H 'Content-Type: application/json' -d '{"status":"start"}' http://localhost:5000/control/:queue_name
 
     # fetch the status of a queue
-    curl http://localhost:5000/control/queuename
+    curl http://localhost:5000/control/:queue_name
 
 =head1 DESCRIPTION
 
@@ -92,7 +92,7 @@ By default, when a queue is created, the status is set to 'open'. When a queue i
 
 =item path
 
-/control/:queuename
+/control/:queue_name
 
 =item request
 
@@ -106,13 +106,31 @@ content : {"status":"0","queue":"foo", next_run_after: "1234"}
 
 =back
 
+If there is some delayed jobs in this queue, the date for the nearlier delayed job will be return in the response. The informations returned are:
+
+=over 2
+
+=item B<queue>
+
+name of the queue
+
+=item B<status>
+
+status of the queue: 1 or 0
+
+=item B<next_run_after>
+
+When will be run the next delayed job
+
+=back
+
 =head2 POST
 
 =over 4
 
 =item path
 
-/control/:queuename
+/control/:queue_name
 
 =item request
 
@@ -128,6 +146,8 @@ content : {"response":"updated","queue":"foo"}
 
 =back
 
+Use this method to B<start> or B<stop> a queue.
+
 =head1 AUTHOR
 
 franck cuny E<lt>franck@lumberjaph.netE<gt>
diff --git a/lib/presque/JobQueueHandler.pm b/lib/presque/JobQueueHandler.pm
index 62ad8da..f108277 100644
--- a/lib/presque/JobQueueHandler.pm
+++ b/lib/presque/JobQueueHandler.pm
@@ -22,7 +22,6 @@ sub get {
         $key,
         sub {
             my $size = shift;
-            warn "ici avec size!\n";
             $self->application->redis->mget(
                 $processed,
                 $failed,
@@ -65,7 +64,7 @@ Return some informations about a queue.
 
 =item path
 
-/j/:queuename
+/j/:queue_name
 
 =item request
 
@@ -75,7 +74,29 @@ content-type: application/json
 
 code: 200
 
-content : {"queue_name":"foo","job_count":"0","job_processed":"127","job_failed":"37"
+content : {"queue_name":"foo","job_count":"0","job_processed":"127","job_failed":"37"}
+
+=back
+
+This method return some statistics about a queue. The informations are :
+
+=over 2
+
+=item B<queue_name>
+
+name of the queue
+
+=item B<job_count>
+
+how many jobs are in the queue
+
+=item B<job_processed>
+
+how many jobs have been processed so far for this queue
+
+=item B<job_failed>
+
+how many job have been reported as failed for this queue
 
 =back
 
diff --git a/lib/presque/StatusHandler.pm b/lib/presque/StatusHandler.pm
index 778aeb4..f15277b 100644
--- a/lib/presque/StatusHandler.pm
+++ b/lib/presque/StatusHandler.pm
@@ -43,8 +43,42 @@ presque::StatusHandler - return the current size of a queue
 
 =head1 DESCRIPTION
 
+Return the current size of a queue
+
 =head2 GET
 
+=over 4
+
+=item path
+
+/status/:queue_name
+
+=item request
+
+=item response
+
+content-type : application/json
+
+code : 200
+
+content : {"queue":"queue_name", "size":10}
+
+=back
+
+The response contains the following informations
+
+=over 2
+
+=item B<queue>
+
+name of the queue
+
+=item B<size>
+
+size of the queue
+
+=back
+
 =head1 AUTHOR
 
 franck cuny E<lt>franck@lumberjaph.netE<gt>
diff --git a/lib/presque/WorkerHandler.pm b/lib/presque/WorkerHandler.pm
index dcb6acf..2787f12 100644
--- a/lib/presque/WorkerHandler.pm
+++ b/lib/presque/WorkerHandler.pm
@@ -118,6 +118,7 @@ presque::WorkerHandler
         "processed" : "0",
         "failed" : "0"
     }
+
     # to register the worker "worker_1" on the queue "queuename"
     curl -H 'Content-Type: appplication/json' http://localhost:5000/w/queuename -d '{"worker_id":"worker_1"}'
 
@@ -126,7 +127,7 @@ presque::WorkerHandler
 
 =head1 DESCRIPTION
 
-It iss possible for a worker to register itself against presque. This is not required. The main purpose of registering workers is to collect informations about your workers : what are they doing right now, how many jobs have they failed, how many jobs have they processed, ...
+It's possible for a worker to register itself against presque. This is not required. The main purpose of registering workers is to collect informations about your workers : what are they doing right now, how many jobs have they failed, how many jobs have they processed, ...
 
 =head2 GET
 
@@ -134,11 +135,11 @@ It iss possible for a worker to register itself against presque. This is not req
 
 =item path
 
-/w/queuename
+/w/:queue_name
 
 =item request
 
-query : worker_id OR queue_name
+query : worker_id OR queue_name OR none
 
 =item response
 
@@ -148,7 +149,7 @@ content_type : application/json
 
 =back
 
-When a worker is registered, statistics about this worker are collected.
+If the query parameter is B<worker_id>, stats about this worker are returned. If the query parameter is B<queue_name>, stats about the workers on this queue are returned. If no query parameter is set, stats about the queue are returned.
 
 =head2 DELETE
 
@@ -156,7 +157,7 @@ When a worker is registered, statistics about this worker are collected.
 
 =item path
 
-/w/queuename
+/w/:queue_name
 
 =item request
 
@@ -180,7 +181,7 @@ Register a worker on a queue.
 
 =item path
 
-/w/queuename
+/w/:queue_name
 
 =item request