arsenicum 0.1.2 → 0.1.3

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: 9ab173d20a8fbeb50f1d4099843803ba7cf2dffa
4
- data.tar.gz: beca6681e379afdff0b8937ecf3f26b13da31809
3
+ metadata.gz: 9d49ec4dfbcc45d77e58afdf36d28bee1d06eb68
4
+ data.tar.gz: 291a2344942b30df1fcc03d274cbb49e76a48560
5
5
  SHA512:
6
- metadata.gz: 7f0420449f7150749113320efacc675c391adbe38b08a309c7ff7565a87e09428f59836b986394a60f559b97eb393a79a49c260aadeb1cbf73f4716b00012d55
7
- data.tar.gz: 90c22916d4cb7ce98f5483e9873c8b84496df082c397ba541e56e42de233d9756ca205007c9390ad7d873d66e3ce157d05ca42b1508613c66842c4bb53c7138a
6
+ metadata.gz: 7f29b77fae0f8c344c64916a44d27d0e02f94a818723d09efda39a8069894344389a9b27b71dd21ff38fc36c093999c6a8fb9b89bee9f82f1d5b25b72e2e5726
7
+ data.tar.gz: 3193c124fb5c4c090252a233ea8f7428731155d682f1baa7828ce57ae813c92dbf1bf865dec4aca1e23921134df1dbe07c817242e61ba577a41ed07ff3b7fbdc
@@ -72,18 +72,27 @@ class Arsenicum::Core::Broker
72
72
  end
73
73
 
74
74
  def get_back_worker(worker)
75
- mutex.synchronize{available_workers[worker.pid] = worker}
75
+ mutex.synchronize{
76
+ if worker.active?
77
+ available_workers[worker.pid] = worker
78
+ else
79
+ next_index = workers.count
80
+ remove worker
81
+ worker.stop
82
+ prepare_worker next_index
83
+ end
84
+ }
76
85
  end
77
86
 
78
87
  private
79
88
  def prepare_workers
80
- @worker_count.times do
81
- prepare_worker
89
+ @worker_count.times do |i|
90
+ prepare_worker i
82
91
  end
83
92
  end
84
93
 
85
- def prepare_worker
86
- worker = Arsenicum::Core::Worker.new(self, worker_options)
94
+ def prepare_worker index
95
+ worker = Arsenicum::Core::Worker.new(self, index, worker_options)
87
96
  stock(worker)
88
97
  end
89
98
 
@@ -105,4 +114,4 @@ class Arsenicum::Core::Broker
105
114
  def serialize(value = {})
106
115
  serializer.serialize value
107
116
  end
108
- end
117
+ end
@@ -5,11 +5,12 @@ class Arsenicum::Core::Worker
5
5
  include Arsenicum::Core::IOHelper
6
6
 
7
7
  attr_reader :pid, :in_parent, :out_parent, :thread,
8
- :in_child, :out_child, :active, :broker, :serializer, :formatter
8
+ :in_child, :out_child, :active, :broker, :serializer, :formatter, :index
9
9
  alias_method :active?, :active
10
10
 
11
- def initialize(broker, worker_configuration)
11
+ def initialize(broker, index, worker_configuration)
12
12
  @broker = WeakRef.new broker # avoiding circular references.
13
+ @index = index
13
14
  @serializer = worker_configuration[:serializer]
14
15
  @formatter = worker_configuration[:formatter]
15
16
  @thread = InvokerThread.new(self)
@@ -20,6 +21,7 @@ class Arsenicum::Core::Worker
20
21
  (@in_child, @out_parent) = open_binary_pipes
21
22
 
22
23
  @pid = fork do
24
+ $0 = "arsenicum[worker][#{index}]"
23
25
  [in_parent, out_parent].each(&:close)
24
26
 
25
27
  begin
@@ -1,6 +1,8 @@
1
1
  module Arsenicum
2
2
  module Main
3
3
  def run(config_file)
4
+ $0 = 'arsenicum[main]'
5
+
4
6
  config = Arsenicum::Configuration.new
5
7
  config_file = File.expand_path config_file
6
8
 
@@ -8,7 +10,7 @@ module Arsenicum
8
10
  config.instance_eval script, config_file, 1
9
11
 
10
12
  if config.daemon
11
- Process.daemon
13
+ Process.daemon true, true
12
14
 
13
15
  File.open(config.pidfile_path, 'w:UTF-8') do |f|
14
16
  f.puts $$
@@ -19,7 +21,6 @@ module Arsenicum
19
21
  configure_log config
20
22
 
21
23
  threads = config.queue_configurations.map{|qc|qc.build.start_async}
22
-
23
24
  begin
24
25
  threads.each(&:join)
25
26
  rescue Interrupt
@@ -1,3 +1,3 @@
1
1
  module Arsenicum
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arsenicum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - condor