Sha256: 288ec08fa9528684c82dea60bf60ff6a9de58e40c016d50e4a25faacdf46ac47
Contents?: true
Size: 976 Bytes
Versions: 6
Compression:
Stored size: 976 Bytes
Contents
module Pione module Agent # JobTerminator is an agent that terminates the target agent when # "terminate" command is received. class JobTerminator < TupleSpaceClient set_agent_type :job_terminator, self def initialize(tuple_space, &b) super(tuple_space) @action = b end # # transition definitions # define_transition :wait define_transition :fire chain :init => :wait chain :wait => :fire chain :fire => :terminate # # transition methods # def transit_to_wait tuple = read(TupleSpace::CommandTuple.new(name: "terminate")) status = System::Status.success unless tuple.args.empty? status = tuple.args.first end return status end def transit_to_fire(status) Log::Debug.system("job terminator fires the action %s." % @action) @action.call(status) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems