class Fasten::Task
Attributes
after[RW]
block[RW]
dependants[RW]
depends[RW]
name[RW]
request[RW]
response[RW]
ruby[RW]
run_score[RW]
shell[RW]
weight[RW]
worker[RW]
worker_class[RW]
Public Class Methods
new(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil, weight: 1, worker_class: nil)
click to toggle source
# File lib/fasten/task.rb, line 9 def initialize(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil, weight: 1, worker_class: nil) self.name = name self.shell = shell self.ruby = ruby self.block = block self.request = request self.after = after self.weight = weight self.worker_class = worker_class # ObjectSpace.define_finalizer(self) do # puts "I am dying! pid: #{Process.pid} thread: #{Thread.current} TASK #{@name}" # end block&.object_id # block && begin # # puts "block_id: #{block.object_id} for task #{@name}" # end # block && ObjectSpace.define_finalizer(block) do # puts "I am dying! pid: #{Process.pid} thread: #{Thread.current} TASK #{@name} BLOCK" # end end
Public Instance Methods
kind()
click to toggle source
# File lib/fasten/task.rb, line 49 def kind 'task' end
marshal_dump()
click to toggle source
# File lib/fasten/task.rb, line 34 def marshal_dump [@name, @state, @ini, @fin, @dif, @request, @response, @shell, @ruby, @block&.object_id, @error] end
marshal_load(data)
click to toggle source
# File lib/fasten/task.rb, line 38 def marshal_load(data) @name, @state, @ini, @fin, @dif, @request, @response, @shell, @ruby, block_id, @error = data @block = begin ObjectSpace._id2ref block_id.to_i if block_id rescue StandardError # pass end raise "Sorry, unable to get block for task #{self}, please try using threads" if block_id && !@block.is_a?(Proc) end
to_s()
click to toggle source
# File lib/fasten/task.rb, line 53 def to_s name end