herdst_worker 0.2.20 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/herdst_worker_health +2 -2
- data/lib/herdst_worker/application/facade.rb +1 -18
- data/lib/herdst_worker/queue/processor.rb +37 -36
- data/lib/herdst_worker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9fa8ccaf7c0b1ea579be583057020ce2499ad6d7fd1ea806f526c81d0a3adfe3
|
|
4
|
+
data.tar.gz: 1c4af6793b81b741e308cad5db603fce45bd81dfb408ece724a4091c1c910471
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bf2ce6ce4e78f2f8b409c63d390774028e0296afd81dde6664ba962f60089a8ea275d850adfbffd5970145eb499225d4a377df229c250761db40aa592521e24
|
|
7
|
+
data.tar.gz: 42c9f0b24900bef7ede09b10d0200cafa878f24dbd7d8506c4ea69f11555496b1c70bf6b67da800c1c2cc88c5409d5b8a1818e965cb05891fb4bf50b451acecb
|
data/bin/herdst_worker_health
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
tmp_path = Dir.pwd + "/tmp"
|
|
4
|
-
process_id = File.new(tmp_path + "/process_id").read rescue nil
|
|
5
|
-
process_status = File.new(tmp_path + "/process_status").read rescue nil
|
|
4
|
+
process_id = File.new(tmp_path + "/process_id").read.strip rescue nil
|
|
5
|
+
process_status = File.new(tmp_path + "/process_status").read.strip rescue nil
|
|
6
6
|
unhealthy = process_id == nil || ["stopped"].include?(process_status)
|
|
7
7
|
|
|
8
8
|
Kernel.exit(unhealthy ? 1 : 0)
|
|
@@ -91,24 +91,7 @@ module HerdstWorker
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
def register_new_task
|
|
94
|
-
|
|
95
|
-
# credentials = self.config.metadata.get_aws_credentials!
|
|
96
|
-
# ecs_client = Aws::ECS::Client.new(
|
|
97
|
-
# :region => info[:region],
|
|
98
|
-
# :credentials => credentials
|
|
99
|
-
# )
|
|
100
|
-
|
|
101
|
-
# resp = ecs_client.update_service({
|
|
102
|
-
# :cluster => info[:cluster],
|
|
103
|
-
# :service => info[:service_name],
|
|
104
|
-
|
|
105
|
-
# # :task_definition => "amazon-ecs-sample",
|
|
106
|
-
|
|
107
|
-
# :desired_count => desired_count,
|
|
108
|
-
# })
|
|
109
|
-
|
|
110
|
-
# puts "info"
|
|
111
|
-
# puts info.inspect
|
|
94
|
+
|
|
112
95
|
end
|
|
113
96
|
|
|
114
97
|
|
|
@@ -181,50 +181,51 @@ module HerdstWorker
|
|
|
181
181
|
self.job_count -= 1
|
|
182
182
|
|
|
183
183
|
}.rescue { |ex|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
else
|
|
195
|
-
self.app.logger.queue.error "Message failed #{attempt_number} times, Adding back to queue."
|
|
196
|
-
|
|
197
|
-
if self.app.config.is_dev?
|
|
198
|
-
puts ex.inspect
|
|
199
|
-
puts ex.backtrace
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
replaced_message = {
|
|
203
|
-
:queue_url => self.poller.queue_url,
|
|
204
|
-
:message_body => msg.body,
|
|
205
|
-
:delay_seconds => self.visibility_timeout,
|
|
206
|
-
:message_attributes => msg_attrs.merge({
|
|
207
|
-
"attempts" => {
|
|
208
|
-
:string_value => attempt_number.to_s,
|
|
209
|
-
:data_type => "Number"
|
|
184
|
+
begin
|
|
185
|
+
if will_fail_permanently
|
|
186
|
+
self.app.logger.queue.error "Message failed #{attempt_number} times, Reporting and failing permanently. \n#{ex.to_s} \n#{ex.backtrace.join("\n")}"
|
|
187
|
+
Sentry.capture_exception(ex, {
|
|
188
|
+
:level => "fatal",
|
|
189
|
+
:extra => {
|
|
190
|
+
"queue_attempts" => attempt_number,
|
|
191
|
+
"queue_message_body" => msg.body
|
|
210
192
|
}
|
|
211
193
|
})
|
|
212
|
-
|
|
194
|
+
|
|
195
|
+
else
|
|
196
|
+
self.app.logger.queue.error "Message failed #{attempt_number} times, Adding back to queue."
|
|
197
|
+
|
|
198
|
+
self.poller.client.send_message({
|
|
199
|
+
:queue_url => self.poller.queue_url,
|
|
200
|
+
:message_body => msg.body,
|
|
201
|
+
:delay_seconds => self.visibility_timeout,
|
|
202
|
+
:message_attributes => msg_attrs.merge({
|
|
203
|
+
"attempts" => {
|
|
204
|
+
:string_value => attempt_number.to_s,
|
|
205
|
+
:data_type => "Number"
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
end
|
|
213
210
|
|
|
214
|
-
self.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
if self.app.config.is_dev?
|
|
212
|
+
self.app.logger.queue.error "Processor Error:"
|
|
213
|
+
self.app.logger.queue.error ex.message
|
|
214
|
+
self.app.logger.queue.error ex.backtrace
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
rescue Exception => inner_ex
|
|
218
|
+
self.app.logger.queue.error inner_ex.message
|
|
219
|
+
|
|
220
|
+
ensure
|
|
221
|
+
self.job_count -= 1
|
|
222
|
+
|
|
221
223
|
end
|
|
222
|
-
|
|
223
|
-
self.job_count -= 1
|
|
224
224
|
}.execute
|
|
225
225
|
else
|
|
226
226
|
self.poller.change_message_visibility_timeout(msg, 5)
|
|
227
227
|
throw :skip_delete
|
|
228
|
+
|
|
228
229
|
end
|
|
229
230
|
end
|
|
230
231
|
|