lib/tengine/job/jobnet_actual.rb in tengine_job-0.6.13 vs lib/tengine/job/jobnet_actual.rb in tengine_job-1.1.0

- old
+ new

@@ -50,6 +50,35 @@ i.stopped_at = t end end end + def fire_stop_event(root_jobnet, options = Hash.new) + root_jobnet_id = root_jobnet.id.to_s + result = Tengine::Job::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 end