skyrunner 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37d6d89a9e1f734ed6a46610d822b6ef19f80323
4
- data.tar.gz: ea79aca278152621d7baa6cad890820daa6a5be6
3
+ metadata.gz: f470ededf6f80989cfd681b1948cbb4133096af7
4
+ data.tar.gz: 68e4bd35332959a1fbcaace10c327618906c8062
5
5
  SHA512:
6
- metadata.gz: b851b35f64f494b2b340d7a476c3c9c6bd874c408e1c2c89bbf8fb8ebfb8a92146380619a63482ef4b4560f2d14a0bb7678342a701be9e2baa6c3980f00ec9a4
7
- data.tar.gz: 2610b2bf6082dc62513e648d41a5133ec98db858940ff675273622a8a30abd4a353e05baf40e88f4b57d780fa4e5bd52da2bcef5f1ad3b6850e173f345c37f71
6
+ metadata.gz: ddd6de5dc9e50e1fc3b59eb85316194ea177b97d27ee658d244199ecdc29e3f3023ca48ef60ab96445ccf469e99459b57c31663176de51cd1a811292e5adfcfd
7
+ data.tar.gz: 8a42bcaada30b93c13b3eacba76de78b206e19714a4a6ddbfd618829fb1b699547c54c2054245c2fd92663f50a2abeb742bb373c8482e1986214384bca055abd
data/README.md CHANGED
@@ -39,7 +39,7 @@ To gracefully shut down a consumer, send it SIGINT (or hit Ctrl-C if you have a
39
39
 
40
40
  See `jobs/example_job.rb` for an example job. To run a job, just call `execute!` on the job, passing any named job arguments you want. The job class should implement the method `run`. This method will get passed the job arguments. For each task you want consumers to run, `run` should yield an array of two elements, the first being the name of the method on the job class to run for the task, and the second a Hash of method arguments. Note that the consumer is (by default) multi-threaded, so please be sure your task methods are thread-safe.
41
41
 
42
- You can specify `on_complete` and `on_failure` method(s) to call when the tasks are all completed, or if any of them fail, respectively. These methods will also be passed the original job arguments. Importantly, the completion method is guaranteed to be called once and only once, when the final task has been completed.
42
+ You can specify `on_complete` and `on_failure` method(s) to call when the tasks are all completed, or if any of them fail, respectively. These methods will also be passed the original job arguments. Importantly, the completion method is guaranteed to be called once and only once, when the final task has been completed. If your job runs multiple tasks, SkyRunner will coordinate the job via DynamoDB and the last consumer will run the completion method. If your job runs a single task, DynamoDB is not needed for coordination and the consumer which consumes your task will call the completion or failure method.
43
43
 
44
44
  If any of your tasks fail in a job, consumers will stop consuming tasks for that job and deplete any queued tasks on SQS. SkyRunner does not currently retry failed tasks, for now you'll need to implement your own retry logic in your task method instead.
45
45
 
data/lib/skyrunner/job.rb CHANGED
@@ -53,7 +53,7 @@ module SkyRunner::Job
53
53
  if messages.size > 1
54
54
  SkyRunner::retry_dynamo_db do
55
55
  table = SkyRunner.dynamo_db_table
56
- record = table.items.put(id: job_id, task_id: job_id, class: self.class.name, args: job_args.to_json, total_tasks: 1, completed_tasks: 0, done: 0, failed: 0)
56
+ record = table.items.put(id: job_id, created_at: Time.now.to_s, task_id: job_id, class: self.class.name, args: job_args.to_json, total_tasks: 1, completed_tasks: 0, done: 0, failed: 0)
57
57
  end
58
58
  else
59
59
  fired_solo = true
@@ -173,6 +173,7 @@ module SkyRunner::Job
173
173
  SkyRunner::retry_dynamo_db do
174
174
  record.attributes.update(if: if_condition) do |u|
175
175
  u.add(done: 1)
176
+ u.set(completed_at: Time.now.to_s)
176
177
  end
177
178
  end
178
179
  end
@@ -1,3 +1,3 @@
1
1
  module Skyrunner
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Fodor