Class: RbEAI::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/rbeai/TasksLogic.rb

Direct Known Subclasses

EndTask, IOTask, RouterTask, StartTask, TransfTask

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/rbeai/TasksLogic.rb', line 14

def name
  @name
end

#nextTaskObject

Returns the value of attribute nextTask.



13
14
15
# File 'lib/rbeai/TasksLogic.rb', line 13

def nextTask
  @nextTask
end

#sizeObject

Returns the value of attribute size.



13
14
15
# File 'lib/rbeai/TasksLogic.rb', line 13

def size
  @size
end

#statusObject

Returns the value of attribute status.



13
14
15
# File 'lib/rbeai/TasksLogic.rb', line 13

def status
  @status
end

#wflowObject

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