Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updating getting started docs w/new imports

  • Loading branch information...
commit 1b7f09920fc541e72160731000001fb3e7454841 1 parent ea7ecee
Charles Leifer authored August 10, 2012

Showing 1 changed file with 15 additions and 17 deletions. Show diff stats Hide diff stats

  1. 32  docs/getting-started.rst
32  docs/getting-started.rst
Source Rendered
@@ -25,9 +25,9 @@ There are three main components (or processes) to consider when running huey:
25 25
 * the queue where tasks are stored, e.g. Redis
26 26
 
27 27
 These three processes are shown in the screenshot below -- the left-hand pane
28  
-shows the producer: a simple program that asks the user for input on how many 
29  
-"beans" to count.  In the top-right, the consumer is running.  It is doing the 
30  
-actual "computation" and simply printing the number of beans counted.  In the 
  28
+shows the producer: a simple program that asks the user for input on how many
  29
+"beans" to count.  In the top-right, the consumer is running.  It is doing the
  30
+actual "computation" and simply printing the number of beans counted.  In the
31 31
 bottom-right is the queue, Redis in this example, which we're monitoring and
32 32
 shows tasks being enqueued (``LPUSH``) and read (``BRPOP``) from the database.
33 33
 
@@ -47,9 +47,8 @@ use, where to log activity, etc.
47 47
 .. code-block:: python
48 48
 
49 49
     # config.py
  50
+    from huey import BaseConfiguration, Invoker
50 51
     from huey.backends.redis_backend import RedisBlockingQueue
51  
-    from huey.bin.config import BaseConfiguration
52  
-    from huey.queue import Invoker
53 52
 
54 53
 
55 54
     queue = RedisBlockingQueue('test-queue', host='localhost', port=6379)
@@ -61,15 +60,15 @@ use, where to log activity, etc.
61 60
         THREADS = 4
62 61
 
63 62
 The interesting parts of this configuration module are the :py:class:`Invoker` object
64  
-and the :py:class:`RedisBlockingQueue` object.  The ``queue`` is responsible for 
65  
-storing and retrieving messages, and the ``invoker`` is used by your application 
66  
-code to coordinate function calls with a queue backend.  We'll see how the ``invoker`` 
  63
+and the :py:class:`RedisBlockingQueue` object.  The ``queue`` is responsible for
  64
+storing and retrieving messages, and the ``invoker`` is used by your application
  65
+code to coordinate function calls with a queue backend.  We'll see how the ``invoker``
67 66
 is used when looking at the actual function responsible for counting beans:
68 67
 
69 68
 .. code-block:: python
70 69
 
71 70
     # commands.py
72  
-    from huey.decorators import queue_command
  71
+    from huey import queue_command
73 72
 
74 73
     from config import invoker # import the invoker we instantiated in config.py
75 74
 
@@ -113,15 +112,14 @@ Getting results from jobs
113 112
 ^^^^^^^^^^^^^^^^^^^^^^^^^
114 113
 
115 114
 The above example illustrates a "send and forget" approach, but what if your
116  
-application needs to do something with the results of a task?  To get results 
  115
+application needs to do something with the results of a task?  To get results
117 116
 from your tasks, we'll set up the ``RedisDataStore`` by adding the following
118 117
 lines to the ``config.py`` module:
119 118
 
120 119
 .. code-block:: python
121 120
 
  121
+    from huey import BaseConfiguration, Invoker
122 122
     from huey.backends.redis_backend import RedisBlockingQueue, RedisDataStore
123  
-    from huey.bin.config import BaseConfiguration
124  
-    from huey.queue import Invoker
125 123
 
126 124
 
127 125
     queue = RedisBlockingQueue('test-queue', host='localhost', port=6379)
@@ -140,7 +138,7 @@ module to return a string rather than simply printing to stdout:
140 138
 
141 139
 .. code-block:: python
142 140
 
143  
-    from huey.decorators import queue_command
  141
+    from huey import queue_command
144 142
 
145 143
     from config import invoker
146 144
 
@@ -219,7 +217,7 @@ Here is a task that will be retried 3 times and will blow up every time:
219 217
 .. code-block:: python
220 218
 
221 219
     # commands.py
222  
-    from huey.decorators import queue_command
  220
+    from huey import queue_command
223 221
 
224 222
     from config import invoker
225 223
 
@@ -248,7 +246,7 @@ delay, and also to print the current time to show that its working.
248 246
 
249 247
     # commands.py
250 248
     from datetime import datetime
251  
-    
  249
+
252 250
     @queue_command(invoker, retries=3, retry_delay=10)
253 251
     def try_thrice():
254 252
         print 'trying....%s' % datetime.now()
@@ -275,7 +273,7 @@ test that the consumer is executing the tasks on schedule.
275 273
 
276 274
     # commands.py
277 275
     from datetime import datetime
278  
-    from huey.decorators import queue_command, periodic_command, crontab
  276
+    from huey import queue_command, periodic_command, crontab
279 277
 
280 278
     from config import invoker
281 279
 
@@ -283,7 +281,7 @@ test that the consumer is executing the tasks on schedule.
283 281
     @queue_command(invoker)
284 282
     def count_beans(num):
285 283
         return 'Counted %s beans' % num
286  
-    
  284
+
287 285
     @queue_command(invoker, retries=3, retry_delay=10)
288 286
     def try_thrice():
289 287
         print 'trying....%s' % datetime.now()

0 notes on commit 1b7f099

Please sign in to comment.
Something went wrong with that request. Please try again.