skyrunner 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skyrunner/version.rb +1 -1
- data/lib/skyrunner.rb +13 -12
- 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: 4a2ced9a38b36395ef00e5eacfb9d6ff57711f06
|
4
|
+
data.tar.gz: 95ec876e3a8e95eca0498b451ae677ef390a1e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ad890cdaa3a625f0056587a18f56601c2ac5d9a9039a5151805ee109ad2f4c19b79dadc9637790bb1eaee70f681ad20c3cc8ce9f6208bcb0c8053479b571f0
|
7
|
+
data.tar.gz: d05d068716f2c988700810eed2083bc18f940135ec5fcada0e5c275723b13f53dff9970e7eba791c096160635df529be8249c1b14d8f3c7b621a17c902d0a16b
|
data/lib/skyrunner/version.rb
CHANGED
data/lib/skyrunner.rb
CHANGED
@@ -73,25 +73,26 @@ module SkyRunner
|
|
73
73
|
|
74
74
|
1.upto(SkyRunner::num_threads) do
|
75
75
|
threads << Thread.new do
|
76
|
-
sqs = AWS::SQS.new
|
77
|
-
|
78
76
|
loop do
|
79
|
-
break if SkyRunner::stop_consuming?
|
77
|
+
break if SkyRunner::stop_consuming? && local_queue.size == 0
|
78
|
+
|
80
79
|
sleep 1 unless local_queue.size > 0
|
81
80
|
|
82
81
|
klass, job_id, task_args, message = local_queue.pop
|
83
82
|
|
84
|
-
|
83
|
+
if klass
|
84
|
+
SkyRunner::log :info, "Run Task: #{task_args} Job: #{job_id} Message: #{message.id}"
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
job = klass.new
|
87
|
+
job.skyrunner_job_id = job_id
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
begin
|
90
|
+
job.consume!(task_args)
|
91
|
+
message.delete
|
92
|
+
rescue Exception => e
|
93
|
+
error_queue.push(e)
|
94
|
+
SkyRunner::log :error, "Task Failed: #{task_args} Job: #{job_id} #{e.message} #{e.backtrace.join("\n")}"
|
95
|
+
end
|
95
96
|
end
|
96
97
|
end
|
97
98
|
end
|