Module: Tengine::Job::Runtime::Stoppable
- Extended by:
- ActiveSupport::Concern
- Included in:
- NamedVertex
- Defined in:
- lib/tengine/job/runtime/stoppable.rb
Overview
ジョブ/ジョブネットを実行する際の情報に関するモジュール Tengine::Job::Runtime::Jobnet, Tengine::Job::Template::Jobnetがこのモジュールをincludeします
Instance Method Summary collapse
- #fire_stop_event(root_jobnet, options = Hash.new) ⇒ Object
- #stop_reason=(r) ⇒ Object
- #stopped_at=(t) ⇒ Object
Instance Method Details
#fire_stop_event(root_jobnet, options = Hash.new) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/tengine/job/runtime/stoppable.rb', line 35 def fire_stop_event(root_jobnet, = Hash.new) root_jobnet_id = root_jobnet.id.to_s result = Tengine::Job::Runtime::Execution.create!( .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) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/tengine/job/runtime/stoppable.rb', line 17 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) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/tengine/job/runtime/stoppable.rb', line 26 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 |