Class: RbEAI::Task
- Inherits:
-
Object
- Object
- RbEAI::Task
- Defined in:
- lib/rbeai/TasksLogic.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nextTask ⇒ Object
Returns the value of attribute nextTask.
-
#size ⇒ Object
Returns the value of attribute size.
-
#status ⇒ Object
Returns the value of attribute status.
-
#wflow ⇒ Object
Returns the value of attribute wflow.
Instance Method Summary collapse
- #doJob(resultQueue, obj) ⇒ Object
- #getItemsNext(numItems) ⇒ Object
-
#initialize(wflow, xmlFull, xmlDoc) ⇒ Task
constructor
A new instance of Task.
- #persist(object) ⇒ Object
- #persistFtp(object) ⇒ Object
- #persistStr(object, filename) ⇒ Object
Constructor Details
#initialize(wflow, xmlFull, xmlDoc) ⇒ Task
Returns a new instance of Task.
18 19 20 21 22 23 24 25 |
# File 'lib/rbeai/TasksLogic.rb', line 18 def initialize(wflow, xmlFull, xmlDoc) @size = (pool_size = xmlDoc.attributes["pool"]) != nil ? pool_size.to_i : 1 @wflow = wflow @name = xmlDoc.attributes["name"] @status = 0 @nextTask = _getNextTask(wflow, xmlFull, xmlDoc) print @name,"\n" end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/rbeai/TasksLogic.rb', line 14 def name @name end |
#nextTask ⇒ Object
Returns the value of attribute nextTask.
13 14 15 |
# File 'lib/rbeai/TasksLogic.rb', line 13 def nextTask @nextTask end |
#size ⇒ Object
Returns the value of attribute size.
13 14 15 |
# File 'lib/rbeai/TasksLogic.rb', line 13 def size @size end |
#status ⇒ Object
Returns the value of attribute status.
13 14 15 |
# File 'lib/rbeai/TasksLogic.rb', line 13 def status @status end |
#wflow ⇒ Object
Returns the value of attribute wflow.
13 14 15 |
# File 'lib/rbeai/TasksLogic.rb', line 13 def wflow @wflow end |
Instance Method Details
#doJob(resultQueue, obj) ⇒ Object
27 28 29 |
# File 'lib/rbeai/TasksLogic.rb', line 27 def doJob(resultQueue, obj) resultQueue.enq(obj) end |
#getItemsNext(numItems) ⇒ Object
31 32 33 |
# File 'lib/rbeai/TasksLogic.rb', line 31 def getItemsNext(numItems) return numItems end |
#persist(object) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/rbeai/TasksLogic.rb', line 35 def persist(object) bname = File.basename("#{object}") rio("tmp/#{@wflow.instid}/#{@name}").mkdir rio("#{object}") > rio("tmp/#{@wflow.instid}/#{@name}") return rio("tmp/#{@wflow.instid}/#{@name}/#{bname}") end |
#persistFtp(object) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/rbeai/TasksLogic.rb', line 42 def persistFtp(object) bname = File.basename("#{object}") rio("tmp/#{@wflow.instid}/#{@name}").mkdir rio("#{object}") > rio("tmp/#{@wflow.instid}/#{@name}/#{bname}") return rio("tmp/#{@wflow.instid}/#{@name}/#{bname}") end |
#persistStr(object, filename) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/rbeai/TasksLogic.rb', line 49 def persistStr(object, filename) rio("tmp/#{@wflow.instid}/#{@name}").mkdir ario = rio("tmp/#{@wflow.instid}/#{@name}/#{filename}") ario.print(object).close return ario end |