Class: Fasten::Task
- Inherits:
-
Object
- Object
- Fasten::Task
- Includes:
- Support::State
- Defined in:
- lib/fasten/task.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#block ⇒ Object
Returns the value of attribute block.
-
#dependants ⇒ Object
Returns the value of attribute dependants.
-
#depends ⇒ Object
Returns the value of attribute depends.
-
#name ⇒ Object
Returns the value of attribute name.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#ruby ⇒ Object
Returns the value of attribute ruby.
-
#run_score ⇒ Object
Returns the value of attribute run_score.
-
#shell ⇒ Object
Returns the value of attribute shell.
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#worker ⇒ Object
Returns the value of attribute worker.
-
#worker_class ⇒ Object
Returns the value of attribute worker_class.
Attributes included from Support::State
#dif, #error, #fin, #ini, #runner, #state
Instance Method Summary collapse
-
#initialize(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil, weight: 1, worker_class: nil) ⇒ Task
constructor
A new instance of Task.
- #kind ⇒ Object
- #marshal_dump ⇒ Object
- #marshal_load(data) ⇒ Object
- #to_s ⇒ Object
Methods included from Support::State
#deps, #deps_str, #idle?, #last_avg, #last_err, #last_stat, #paused?, #pausing?, #quitting?, #running?
Constructor Details
#initialize(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil, weight: 1, worker_class: nil) ⇒ Task
Returns a new instance of Task.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fasten/task.rb', line 10 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 end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
7 8 9 |
# File 'lib/fasten/task.rb', line 7 def after @after end |
#block ⇒ Object
Returns the value of attribute block.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def block @block end |
#dependants ⇒ Object
Returns the value of attribute dependants.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def dependants @dependants end |
#depends ⇒ Object
Returns the value of attribute depends.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def depends @depends end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/fasten/task.rb', line 7 def name @name end |
#request ⇒ Object
Returns the value of attribute request.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def response @response end |
#ruby ⇒ Object
Returns the value of attribute ruby.
7 8 9 |
# File 'lib/fasten/task.rb', line 7 def ruby @ruby end |
#run_score ⇒ Object
Returns the value of attribute run_score.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def run_score @run_score end |
#shell ⇒ Object
Returns the value of attribute shell.
7 8 9 |
# File 'lib/fasten/task.rb', line 7 def shell @shell end |
#weight ⇒ Object
Returns the value of attribute weight.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def weight @weight end |
#worker ⇒ Object
Returns the value of attribute worker.
8 9 10 |
# File 'lib/fasten/task.rb', line 8 def worker @worker end |
#worker_class ⇒ Object
Returns the value of attribute worker_class.
7 8 9 |
# File 'lib/fasten/task.rb', line 7 def worker_class @worker_class end |
Instance Method Details
#kind ⇒ Object
32 33 34 |
# File 'lib/fasten/task.rb', line 32 def kind 'task' end |
#marshal_dump ⇒ Object
21 22 23 |
# File 'lib/fasten/task.rb', line 21 def marshal_dump [@name, @state, @ini, @fin, @dif, @request, @response, @shell, @ruby, @block&.object_id, @error] end |
#marshal_load(data) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/fasten/task.rb', line 25 def marshal_load(data) @name, @state, @ini, @fin, @dif, @request, @response, @shell, @ruby, block_id, @error = data @block = ObjectSpace._id2ref block_id if block_id raise "Sorry, unable to get block for task #{self}, please try using threads" if block_id && !@block.is_a?(Proc) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/fasten/task.rb', line 36 def to_s name end |