Class: Tengine::Job::Runtime::NamedVertex
- Inherits:
-
Vertex
- Object
- Vertex
- Tengine::Job::Runtime::NamedVertex
- Includes:
- Core::OptimisticLock, Executable, Stoppable
- Defined in:
- lib/tengine/job/runtime/named_vertex.rb
Overview
処理を意味するVertex。実際に実行を行うTengine::Job::Scriptやジョブネットである Tengine::Job::Runtime::Jobnetの継承元である。
Instance Method Summary collapse
-
#name_as_resource ⇒ Object
リソース識別子を返します.
- #reset_followings(signal) ⇒ Object
- #root_or_expansion ⇒ Object
- #short_inspect ⇒ Object
- #template_vertex ⇒ Object
- #update_with_lock(*args) ⇒ Object
Instance Method Details
#name_as_resource ⇒ Object
リソース識別子を返します
18 19 20 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 18 def name_as_resource @name_as_resource ||= "job:#{Tengine::Event.host_name}/#{Process.pid.to_s}/#{root.id.to_s}/#{id.to_s}" end |
#reset_followings(signal) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 64 def reset_followings(signal) return if parent.nil? return unless signal.execution.in_scope?(self) edge_owner = signal.cache(parent) return if signal.paths.include?(edge_owner) edges, vertecs = [], [] visitor = Tengine::Job::Structure::Visitor::TraceEdge.new do |obj| dest = obj.is_a?(Tengine::Job::Runtime::Edge) ? edges : vertecs dest << obj end (next_edges || []).each{|edge| edge.accept_visitor(visitor)} signal.paths << edge_owner signal.call_later do signal.cache(edge_owner).update_with_lock do edges.each do |edge| next unless signal.execution.in_scope?(edge.destination) signal.cache(edge).phase_key = :active end end vertecs.each do |vertex| next unless signal.execution.in_scope?(vertex) if vertex.is_a?(Tengine::Job::Runtime::NamedVertex) || vertex.is_a?(Tengine::Job::Runtime::End) signal.call_later do signal.cache(vertex).reset(signal) end end end end end |
#root_or_expansion ⇒ Object
30 31 32 33 34 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 30 def root_or_expansion p = parent raise "something wrong!" if p.nil? && !self.is_a?(Tengine::Job::Runtime::Jobnet) p.nil? ? self : p.was_expansion ? p : p.root_or_expansion end |
#short_inspect ⇒ Object
22 23 24 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 22 def short_inspect "#<%%%-30s id: %s name: %s>" % [self.class.name, self.id.to_s, name] end |
#template_vertex ⇒ Object
57 58 59 60 61 62 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 57 def template_vertex r = root_or_expansion # return nil unless parent # templateから生成される途中だとparentがnilの場合があります t = r.template t.nil? ? nil : t.vertex_by_absolute_name_path(name_path_until_expansion) end |
#update_with_lock(*args) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/tengine/job/runtime/named_vertex.rb', line 36 def update_with_lock(*args) if @in_update_with_lock Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} before yield in nested update_with_lock") yield if block_given? Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} after yield in nested update_with_lock") return end @in_update_with_lock = true begin Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} before update_with_lock") super(*args) do Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} before yield in update_with_lock") yield if block_given? Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} after yield in update_with_lock") end Tengine::Job.test_harness_hook("[#{self.class.name}] #{name_path} after update_with_lock") ensure @in_update_with_lock = false end end |