job_dispatch 0.1.0 → 0.2.0
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/CHANGELOG.md +5 -0
- data/lib/job_dispatch/broker.rb +1 -1
- data/lib/job_dispatch/client.rb +7 -0
- data/lib/job_dispatch/version.rb +1 -1
- data/lib/job_dispatch/worker/item.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 005b4540e1048fcd212b6ee3199a76d95241c561
|
4
|
+
data.tar.gz: edf3b9db5684d47087a8a5e3daa0705996d05ef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce120d42781bddef5573e83ae6f233ad0a4f01b24809228f00eb0f018847d1cbc15e3250252fcf914f683cb79474117c4901be97d8442bd3182e9888f05576d9
|
7
|
+
data.tar.gz: 90652e341a3e9f47d2a3188e0b16c629f8728c3efae96ef3e93b28034d81056ed24a8a34cb3d131aa78312ef89dc758b0aa14e2fc9ab616a740f0d5a86053a52
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# job_dispatch change log
|
2
2
|
|
3
|
+
## Version 0.2.0
|
4
|
+
|
5
|
+
* Added -n option to `lsof` to make status checks faster
|
6
|
+
* Adding notify_error method to Worker::Item class for applications to report worker item execution errors.
|
7
|
+
|
3
8
|
## Version 0.1.0
|
4
9
|
|
5
10
|
* Added 'num_tcp_connections' to status command response
|
data/lib/job_dispatch/broker.rb
CHANGED
@@ -451,7 +451,7 @@ module JobDispatch
|
|
451
451
|
|
452
452
|
|
453
453
|
def status_response
|
454
|
-
num_tcp_connections = `lsof -
|
454
|
+
num_tcp_connections = `lsof -np #{Process.pid}`.split.select { |l| l=~ /TCP/ }.count
|
455
455
|
|
456
456
|
response = {
|
457
457
|
:status => status,
|
data/lib/job_dispatch/client.rb
CHANGED
@@ -34,6 +34,13 @@ module JobDispatch
|
|
34
34
|
SynchronousProxy.new(self, target, options)
|
35
35
|
end
|
36
36
|
|
37
|
+
def close
|
38
|
+
if @socket
|
39
|
+
@socket.close
|
40
|
+
@socket = nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
37
44
|
# Enqueue a job to be processed describe by the passed job attributes.
|
38
45
|
#
|
39
46
|
# Required attributes:
|
data/lib/job_dispatch/version.rb
CHANGED
@@ -30,6 +30,9 @@ module JobDispatch
|
|
30
30
|
@result = @klass.__send__(method.to_sym, *params)
|
31
31
|
@status = :success
|
32
32
|
rescue StandardError => ex
|
33
|
+
|
34
|
+
notify_error(ex) rescue nil
|
35
|
+
|
33
36
|
@result = {
|
34
37
|
class: ex.class.to_s,
|
35
38
|
message: ex.to_s,
|
@@ -42,6 +45,10 @@ module JobDispatch
|
|
42
45
|
JobDispatch.logger.info "Worker completed job #{job_id}: #{target}.#{method}, status: #{@status}"
|
43
46
|
end
|
44
47
|
end
|
48
|
+
|
49
|
+
def notify_error(exception)
|
50
|
+
# subclass this to send error notifications
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_dispatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Connolly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbczmq
|