module Tengine::Job::Runtime::Stoppable

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

Public Instance Methods

fire_stop_event(root_jobnet, options = Hash.new) click to toggle source
# File lib/tengine/job/runtime/stoppable.rb, line 34
def fire_stop_event(root_jobnet, options = Hash.new)
  root_jobnet_id = root_jobnet.id.to_s
  result = Tengine::Job::Runtime::Execution.create!(
    options.merge(:root_jobnet_id => root_jobnet_id))
  properties = {
    :execution_id => result.id.to_s,
    :root_jobnet_id => root_jobnet_id,
    :stop_reason => "user_stop"
  }

  target_id = self.id.to_s
  # if target.children.blank?
  if script_executable?
    event = :"stop.job.job.tengine"
    properties[:target_job_id] = target_id
    properties[:target_jobnet_id] = parent.id.to_s
  else
    event = :"stop.jobnet.job.tengine"
    properties[:target_jobnet_id] = target_id
  end

  EM.run do
    Tengine::Event.fire(event,
      :source_name => name_as_resource,
      :properties => properties)
  end

  return result
end
stop_reason=(r) click to toggle source

www.pivotaltracker.com/story/show/23329935

Calls superclass method
# File lib/tengine/job/runtime/stoppable.rb, line 16
def stop_reason= r
  super
  children.each do |i|
    if i.respond_to?(:chained_box?) && i.chained_box?
      i.stop_reason = r
    end
  end
end
stopped_at=(t) click to toggle source
Calls superclass method
# File lib/tengine/job/runtime/stoppable.rb, line 25
def stopped_at= t
  super
  children.each do |i|
    if i.respond_to?(:chained_box?) && i.chained_box?
      i.stopped_at = t
    end
  end
end