disc 0.0.28 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -15
  3. data/lib/disc/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5afabb650aa27d3b020674c300b2c2f198da7562
4
- data.tar.gz: 309002ddceb18dbbae790371d6761330044591ef
3
+ metadata.gz: 7e4f52b8bcd6d2c7b0648a5943c23f41c2fc71b0
4
+ data.tar.gz: 45fded657cbdd9122369e9cee62a0f451fb65309
5
5
  SHA512:
6
- metadata.gz: 73c4688d1d3363c68f4927bfc9096efc1ac353371d1a4f0a67bcf22c48e5bd1f7e9d57f2771d2dbb831340f939531757d160797d0915753a41ef1e11ed9ab2cb
7
- data.tar.gz: c4fa2f21bb5d56b00c658aa72c3e66f307b5c86a77af9f9e9ef917794fd63faa14a2edb16d60a7bd792a78ecdc8cfc29d450a58dea8040ac9c5debd1aade71be
6
+ metadata.gz: 29e37f6f7c7b706345a66699beca6513f3adb1351b61d4a6d99513a207f0798af25a59542514f1728e56254c772e0df5cbfda5cab24a10efe8071abf75b8ec79
7
+ data.tar.gz: d8917b863ef3073e27ed2804174e8719d71d1021adc5c45eca79873a13988eadf9293b2f668936da140f311a204f8a94c57d216bb2a1f69d9ec2089694cfb94a
data/README.md CHANGED
@@ -61,6 +61,20 @@ Disc fills the gap between your Ruby service objects and [antirez](http://antire
61
61
  )
62
62
  ```
63
63
 
64
+ ## Disc Configuration
65
+
66
+ Disc takes its configuration from environment variables.
67
+
68
+ | ENV Variable | Default Value | Description
69
+ |:------------------:|:-----------------|:------------|
70
+ | `QUEUES` | 'default' | The list of queues that `Disc::Worker` will listen to, it can be a single queue name or a list of comma-separated queues |
71
+ | `DISC_CONCURRENCY` | '25' | Amount of threads to spawn when Celluloid is available. |
72
+ | `DISQUE_NODES` | 'localhost:7711' | This is the list of Disque servers to connect to, it can be a single node or a list of comma-separated nodes |
73
+ | `DISQUE_AUTH` | '' | Authorization credentials for Disque. |
74
+ | `DISQUE_TIMEOUT` | '100' | Time in milliseconds that the client will wait for the Disque server to acknowledge and replicate a job |
75
+ | `DISQUE_CYCLE` | '1000' | The client keeps track of which nodes are providing more jobs, after the amount of operations specified in cycle it tries to connect to the preferred node. |
76
+
77
+
64
78
  ## Disc Jobs
65
79
 
66
80
  `Disc::Job` is a module you can include in your Ruby classes, this allows a Disc worker process to execute the code in them by adding a class method (`#enqueue`) with the following signature:
@@ -146,6 +160,38 @@ end
146
160
  ComplexJob.enqueue(['first argument', { second: 'argument' }])
147
161
  ```
148
162
 
163
+ ### Job Status
164
+
165
+ After a job is enqueued, you can check it's current status like so:
166
+
167
+ ```ruby
168
+ Echoer.enqueue('test')
169
+ #=> "DIa18101491133639148a574eb30cd2e12f25dcf8805a0SQ"
170
+
171
+ Disc["DIa18101491133639148a574eb30cd2e12f25dcf8805a0SQ"]
172
+ #=> {
173
+ "arguments"=>["test"],
174
+ "class"=>"Echoer",
175
+ "id"=>"DIa18101491133639148a574eb30cd2e12f25dcf8805a0SQ",
176
+ "queue"=>"test",
177
+ "state"=>"queued",
178
+ "repl"=>1,
179
+ "ttl"=>86391,
180
+ "ctime"=>1462488116652000000,
181
+ "delay"=>0,
182
+ "retry"=>8640,
183
+ "nacks"=>0,
184
+ "additional-deliveries"=>0,
185
+ "nodes-delivered"=>["a18101496d562e412a459c6b114561efe95c57cc"],
186
+ "nodes-confirmed"=>[],
187
+ "next-requeue-within"=>8630995,
188
+ "next-awake-within"=>8630495,
189
+ "body"=>"{\"class\":\"Echoer\",\"arguments\":[\"test\"]}"
190
+ }
191
+ ```
192
+
193
+ This information might vary, as it's retreived from Disque via the [`SHOW`](https://github.com/antirez/disque#show-job-id) command, only `arguments` and `class` are filled in by Disc, which are added by using `Disc.deserialize` on the `body` value.
194
+
149
195
  ### Job Serialization
150
196
 
151
197
  Job information (their arguments, and class) need to be serialized in order to be stored
@@ -158,19 +204,6 @@ By default, these methods use by default the Ruby standard library json implemen
158
204
  2. You can override `Disc.serialize` and `Disc.deserialize` to use a different JSON implementation, or MessagePack, or whatever else you wish.
159
205
 
160
206
 
161
- ## Settings
162
-
163
- Disc takes its configuration from environment variables.
164
-
165
- | ENV Variable | Default Value | Description
166
- |:------------------:|:-----------------|:------------|
167
- | `QUEUES` | 'default' | The list of queues that `Disc::Worker` will listen to, it can be a single queue name or a list of comma-separated queues |
168
- | `DISC_CONCURRENCY` | '25' | Amount of threads to spawn when Celluloid is available. |
169
- | `DISQUE_NODES` | 'localhost:7711' | This is the list of Disque servers to connect to, it can be a single node or a list of comma-separated nodes |
170
- | `DISQUE_AUTH` | '' | Authorization credentials for Disque. |
171
- | `DISQUE_TIMEOUT` | '100' | Time in milliseconds that the client will wait for the Disque server to acknowledge and replicate a job |
172
- | `DISQUE_CYCLE` | '1000' | The client keeps track of which nodes are providing more jobs, after the amount of operations specified in cycle it tries to connect to the preferred node. |
173
-
174
207
  ## Error handling
175
208
 
176
209
  When a job raises an exception, `Disc.on_error` is invoked with the error and
@@ -222,8 +255,6 @@ Disc.queues
222
255
 
223
256
  Returner.enqueue('another test')
224
257
  #=> => {"default"=>[{:arguments=>["test argument"], :class=>"Returner", :options=>{}}, {:arguments=>["another test"], :class=>"Returner", :options=>{}}]}
225
-
226
-
227
258
  ```
228
259
 
229
260
  You can still flush the queues just as you would running on regular mode.
@@ -1,3 +1,3 @@
1
1
  class Disc
2
- VERSION = "0.0.28"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pote
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: disque