Class: DTR::Agent::Herald

Inherits:
ProcessRoot show all
Includes:
Service::Agent, Service::WorkingEnv
Defined in:
lib/dtr/agent/herald.rb

Defined Under Namespace

Classes: WorkingEnvError

Instance Method Summary collapse

Methods included from Service::Agent

#all_agents_info, #new_agent_monitor, #provide_agent_info

Methods included from Service::Rinda

#lookup, #lookup_ring, #start_service, #stop_service

Methods included from Service::WorkingEnv

#lookup_working_env, #provide_working_env

Constructor Details

#initializeHerald

Returns a new instance of Herald.



25
26
27
28
29
30
31
# File 'lib/dtr/agent/herald.rb', line 25

def initialize
  super
  start_service
  start_off
ensure
  stop_service
end

Instance Method Details

#fetch_working_envObject

Raises:



47
48
49
50
51
52
53
54
55
# File 'lib/dtr/agent/herald.rb', line 47

def fetch_working_env
  working_env = lookup_working_env
  DTR.info {"=> Got working environment created at #{working_env[:created_at]} by #{working_env[:host]}"}

  raise WorkingEnvError.new("No test files need to load?(working env: #{working_env})") if working_env[:files].blank?

  working_env.synchronize_for(DTR.configuration.agent_runners)
  working_env
end

#start_offObject



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dtr/agent/herald.rb', line 33

def start_off
  DTR.info {"=> Herald starts off at #{DTR.root}"}
  provide_agent_info(DTR.configuration.agent_env_setup_cmd, DTR.configuration.agent_runners)

  DTR.configuration.working_env = fetch_working_env
rescue WorkingEnvError
  DTR.error $!.message
  exit(-1)
rescue
  DTR.error $!.message
  DTR.error $!.backtrace.join("\n")
  exit(-1)
end