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 +4 -4
- data/README.md +1 -1
- data/lib/skyrunner/job.rb +2 -1
- data/lib/skyrunner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f470ededf6f80989cfd681b1948cbb4133096af7
|
4
|
+
data.tar.gz: 68e4bd35332959a1fbcaace10c327618906c8062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/skyrunner/version.rb
CHANGED