module Tengine::Job::Runtime::Executable

ジョブ/ジョブネットを実行する際の情報に関するモジュール Tengine::Job::Runtime::Jobne, Tengine::Job::Runtime::JobBase、Tengine::Job::Runtime::Executionがこのモジュールをincludeします

Constants

HUMAN_PHASE_KEYS_ADDITIONAL
HUMAN_PHASE_KEYS_HASH

Public Instance Methods

human_phase_key() click to toggle source

可読可能なphase_keyを返します。 具体的にはphase_keyが:dying、:errorの場合は、stop_reasonを考慮した値を返します。

# File lib/tengine/job/runtime/executable.rb, line 77
def human_phase_key
  case phase_key
  when :dying, :error then
    hash = HUMAN_PHASE_KEYS_HASH[self.stop_reason]
    hash ? hash[phase_key] : phase_key
  else phase_key
  end
end
human_phase_name() click to toggle source

human_phase_keyの表示用の文字列を返します。

# File lib/tengine/job/runtime/executable.rb, line 87
def human_phase_name
  I18n.t(human_phase_key, :scope => "selectable_attrs.tengine/job/runtime/jobnet.human_phase_name")
end
phase_key=(phase_key) click to toggle source
# File lib/tengine/job/runtime/executable.rb, line 29
def phase_key=(phase_key)
  element_type =
    case self.class
    when Tengine::Job::Runtime::Execution  then "execution"
    when Tengine::Job::Runtime::RootJobnet then "root_jobnet"
    when Tengine::Job::Runtime::Jobnet     then self.jobnet_type_key == :normal ?  "jobnet" : self.jobnet_type_name
    when Tengine::Job::Runtime::SshJob     then "job"
    end
  caption = respond_to?(:name_path) ? name_path : respond_to?(:name) ? name : inspect
  Tengine.logger.debug("#{element_type} phase changed. <#{ self.id.to_s}> #{caption}  #{self.phase_name} -> #{ self.class.phase_name_by_key(phase_key)}")

  # Tengine.logger.debug(caller.join("\n  "))

  self.write_attribute(:phase_cd, self.class.phase_id_by_key(phase_key))
end
update_children_phase_modified() click to toggle source
# File lib/tengine/job/runtime/executable.rb, line 47
def update_children_phase_modified
  return unless respond_to?(:children)
  children.each do |child|
    if child.respond_to?(:chained_box?) && child.chained_box?
      child.phase_key = phase_key
      child.save!
    end
  end
end
update_phase!(phase_key, attrs = {}) click to toggle source
# File lib/tengine/job/runtime/executable.rb, line 57
def update_phase!(phase_key, attrs = {})
  attrs.each do |key, value|
    self.send("#{key}=", value)
  end
  self.phase_key = phase_key
  self.save!
end