Class: Henry::ExecutionService

Inherits:
Object
  • Object
show all
Defined in:
lib/henry/execution_service.rb

Constant Summary collapse

DRB_URI =

Uri where the service will be listening.

'druby://localhost'
DRB_PORTS =

Range of ports to be used.

(8800..9000)

Class Method Summary collapse

Class Method Details

.start(execution) ⇒ Object

Starts the result service sharing the given result.

Parameters:

  • execution (Execution)

    the Execution to be shared.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/henry/execution_service.rb', line 14

def self.start(execution)
  10.times do
    begin
      drb_uri = "#{DRB_URI}:#{rand(DRB_PORTS)}"
      DRb.start_service(drb_uri, execution)
      ENV['DRB_EXECUTION_URI'] = drb_uri 
    rescue Errno::EADDRINUSE
    end
  end
  
  return false
end

.stopObject

Stops the result service.



28
29
30
31
32
# File 'lib/henry/execution_service.rb', line 28

def self.stop
  DRb.stop_service
rescue
  return false
end