Class: Bullring::RhinoServerWorker
- Inherits:
-
Worker
- Object
- Worker
- Bullring::RhinoServerWorker
show all
- Defined in:
- lib/bullring/workers/rhino_server_worker.rb
Instance Attribute Summary
Attributes inherited from Worker
#libraries
Instance Method Summary
collapse
Methods inherited from Worker
#add_library, #alive?, #check, #discard, #refresh, #run
Constructor Details
Returns a new instance of RhinoServerWorker.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 8
def initialize
super
proxy_options = {}
proxy_options[:caller_name] = "Bullring"
proxy_options[:server] = {
:command => File.join(Bullring.root, "/bullring/workers/rhino_server.sh"),
:args => [Bullring.root,
"start",
"#{Bullring.configuration.server_host}",
"#{Bullring.configuration.registry_port}",
Bullring.configuration.jvm_init_heap_size,
Bullring.configuration.jvm_max_heap_size,
Bullring.configuration.jvm_young_heap_size],
:first_port => "#{Bullring.configuration.first_server_port}",
:max_bringup_time => Bullring.configuration.server_max_bringup_time
}
proxy_options[:registry] = {
:host => "#{Bullring.configuration.server_host}",
:port => "#{Bullring.configuration.registry_port}"
}
proxy_options[:proxy] = {
:host => "#{Bullring.configuration.server_host}"
}
@server = ServerProxy.new(proxy_options)
end
|
Instance Method Details
#_add_library(name, script) ⇒ Object
36
37
38
39
40
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 36
def _add_library(name, script)
rescue_me do
server.store_in_registry('library', name, script)
end
end
|
#_alive? ⇒ Boolean
57
58
59
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 57
def _alive?
server.alive?
end
|
#_check(script, options) ⇒ Object
42
43
44
45
46
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 42
def _check(script, options)
rescue_me do
server.check(script, options)
end
end
|
#_discard ⇒ Object
61
62
63
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 61
def _discard;
server.discard
end
|
#_refresh ⇒ Object
65
66
67
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 65
def _refresh
server.refresh
end
|
#_run(script, options) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/bullring/workers/rhino_server_worker.rb', line 48
def _run(script, options)
options[:run_timeout_secs] ||= Bullring.configuration.execution_timeout_secs
rescue_me do
result = server.run(script, options)
result.respond_to?(:to_h) ? result.to_h : result
end
end
|