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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 401fd02367fe4acc36558989fe00883365afcd87
4
- data.tar.gz: f45f4e6595a88462a394deb27a103d9a9d274ae5
3
+ metadata.gz: 005b4540e1048fcd212b6ee3199a76d95241c561
4
+ data.tar.gz: edf3b9db5684d47087a8a5e3daa0705996d05ef2
5
5
  SHA512:
6
- metadata.gz: d07c1dc6f62db463ec888a8e3130893bfb37541854756477200ecc77d79ae8e0e615d4773925b18f71798fccb59d3bb308c1e8ec7e1696958b9b694dd5e7c161
7
- data.tar.gz: f3a9e4646d3f4e0e1aea6b5b7691758f3b29057215bbc104875239375a6efb0a99f1ea035d86e7e6ed6dc913d87dffcf8731b42c8e8874a52400aadcdccb1348
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
@@ -451,7 +451,7 @@ module JobDispatch
451
451
 
452
452
 
453
453
  def status_response
454
- num_tcp_connections = `lsof -p #{Process.pid}`.split.select { |l| l=~ /TCP/ }.count
454
+ num_tcp_connections = `lsof -np #{Process.pid}`.split.select { |l| l=~ /TCP/ }.count
455
455
 
456
456
  response = {
457
457
  :status => status,
@@ -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:
@@ -1,3 +1,3 @@
1
1
  module JobDispatch
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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.1.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-07-16 00:00:00.000000000 Z
11
+ date: 2014-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbczmq