Upon boot, hydra workers will now require hydra_worker_init.rb in the current working directory if it is present.
This commit is contained in:
parent
585c40ad01
commit
a131de53f1
|
@ -20,6 +20,7 @@ module Hydra #:nodoc:
|
||||||
@runners = []
|
@runners = []
|
||||||
@listeners = []
|
@listeners = []
|
||||||
|
|
||||||
|
load_worker_initializer
|
||||||
boot_runners(opts.fetch(:runners) { 1 })
|
boot_runners(opts.fetch(:runners) { 1 })
|
||||||
@io.write(Hydra::Messages::Worker::WorkerBegin.new)
|
@io.write(Hydra::Messages::Worker::WorkerBegin.new)
|
||||||
|
|
||||||
|
@ -28,7 +29,15 @@ module Hydra #:nodoc:
|
||||||
@runners.each{|r| Process.wait r[:pid] }
|
@runners.each{|r| Process.wait r[:pid] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_worker_initializer
|
||||||
|
if File.exist?('./hydra_worker_init.rb')
|
||||||
|
trace('Requiring hydra_worker_init.rb')
|
||||||
|
require 'hydra_worker_init'
|
||||||
|
else
|
||||||
|
trace('hydra_worker_init.rb not present')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# message handling methods
|
# message handling methods
|
||||||
|
|
||||||
# When a runner wants a file, it hits this method with a message.
|
# When a runner wants a file, it hits this method with a message.
|
||||||
|
|
Loading…
Reference in New Issue