Module: Eye::Process::Data
- Included in:
- ChildProcess, Eye::Process
- Defined in:
- lib/eye/process/data.rb
Instance Method Summary collapse
- #debug_data ⇒ Object
-
#full_name ⇒ Object
logger tag.
- #self_status_data(debug = false) ⇒ Object
- #status_data(debug = false) ⇒ Object
- #sub_object?(obj) ⇒ Boolean
Instance Method Details
#debug_data ⇒ Object
37 38 39 |
# File 'lib/eye/process/data.rb', line 37 def debug_data { queue: scheduler_actions_list, watchers: @watchers.keys } end |
#full_name ⇒ Object
logger tag
4 5 6 |
# File 'lib/eye/process/data.rb', line 4 def full_name @full_name ||= [self[:application], (self[:group] == '__default__') ? nil : self[:group], self[:name]].compact.join(':') end |
#self_status_data(debug = false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eye/process/data.rb', line 21 def self_status_data(debug = false) h = { name: name, state: state, type: (self.class == Eye::ChildProcess ? :child_process : :process), resources: Eye::SystemResources.resources(pid) } if @states_history h.merge!( state_changed_at: @states_history.last_state_changed_at, state_reason: @states_history.last_reason ) end h.merge!(debug: debug_data) if debug h.merge!(current_command: current_scheduled_command) if current_scheduled_command h end |
#status_data(debug = false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/eye/process/data.rb', line 8 def status_data(debug = false) p_st = self_status_data(debug) if childs.present? p_st.merge(:subtree => Eye::Utils::AliveArray.new(childs.values).map{|c| c.status_data(debug) } ) elsif self[:monitor_children] && self.up? p_st.merge(:subtree => [{name: '=loading childs='}]) else # common state p_st end end |
#sub_object?(obj) ⇒ Boolean
41 42 43 44 45 |
# File 'lib/eye/process/data.rb', line 41 def sub_object?(obj) return false if self.class == Eye::ChildProcess self.childs.each { |_, child| return true if child == obj } false end |