Ravn::Tactical::
Diagnostics
module
Module functions for gathering compute pack diagnostic information.
- NORMAL_PROC_STATUSES
Statuses that processes might be in
Returns true
if the BDE is running.
48 def bde_running?
49 bde_procs = self.find_processes( cmdline: 'ravn/bde' )
50 self.log.debug "Found %d BDE processes." % [ bde_procs.size ]
51
52 return self.processes_okay?( bde_procs )
53 end
broker_interface_exists?()
Returns true
if the network interface for the broker exists.
66 def broker_interface_exists?
67 configured_interface = Ravn::Net.interface or return false
68
69 iface = Socket.getifaddrs.find do |interface|
70 interface.name == configured_interface
71 end
72
73 return iface ? true : false
74 end
Returns true
if the Executor is running.
57 def executor_running?
58 executor_procs = self.find_processes( cmdline: 'ravn executor' )
59 self.log.debug "Found executor processes: %p." % [ executor_procs ]
60
61 return self.processes_okay?( executor_procs )
62 end
find_processes( cmdline:, name: 'ruby' )
Find all processes with the given name
and whose command contains cmdline
.
29 def find_processes( cmdline:, name: 'ruby' )
30 processes = Sys::ProcTable.ps
31
32 return processes.select do |proc|
33 proc.name == name && proc.cmdline.include?( cmdline )
34 end
35 end
processes_okay?( processes, count: 1..1 )
Return true if the given array of processes
has a size within the count
and are all in a good state.
40 def processes_okay?( processes, count: 1..1 )
41 return false unless count.cover?( processes.size )
42
43 return processes.all? {|process| NORMAL_PROC_STATUSES.include?(process.state) }
44 end