SPRAAK
Public Member Functions
spr_pylib.train.task.PyTask Class Reference

Defines a task that calls a python function. More...

+ Inheritance diagram for spr_pylib.train.task.PyTask:
+ Collaboration diagram for spr_pylib.train.task.PyTask:

Public Member Functions

def __init__ (self, in_fnames, out_fnames, func, arg, kwarg)
 Constructor. More...
 
def __str__ (self)
 Returns a string representation of the task. More...
 
def run (self, host=None)
 Execute the task. More...
 
def scanForResources (self, resource_list)
 Scans for resources needed by this task. More...
 
def postScan (self)
 Hook for tasks that want to do some extra flagging of resources, eg marking versions as deleted. More...
 
- Public Member Functions inherited from spr_pylib.train.task.Task
def __init__ (self)
 Constructor. More...
 
def setCompleted (self, completed=True)
 
def isCompleted (self)
 
def getName (self)
 Return the name of this task. More...
 
def setName (self, name)
 Set the name of this task. More...
 
def scanForResources (self, resource_list)
 Abstract method. More...
 
def checkResourcesAvailable (self)
 Checks if all the resources needed to run this task are available. More...
 
def markResourcesAvailable (self)
 Mark all resources used by this task as available. More...
 
def run (self, host=None)
 Abstract method. More...
 
def canRunRemote (self)
 Indicates if this task can be run remotely. More...
 
def __str__ (self)
 Returns a string representation of the task. More...
 

Detailed Description

Defines a task that calls a python function.

Constructor & Destructor Documentation

§ __init__()

def spr_pylib.train.task.PyTask.__init__ (   self,
  in_fnames,
  out_fnames,
  func,
  arg,
  kwarg 
)

Constructor.

Parameters
selfThe callee object.
in_fnamesA list of file names that will be used as inputs for the task.
out_fnamesA list of file names that will be used as outputs for the task.
funcThe function to be called.
*argThe positional arguments for the function call.
**kwargThe keyword arguments for the function call.

Member Function Documentation

§ __str__()

def spr_pylib.train.task.PyTask.__str__ (   self)

Returns a string representation of the task.

Returns
A string showing the name of the function and all its arguments.

§ run()

def spr_pylib.train.task.PyTask.run (   self,
  host = None 
)

Execute the task.

No remote execution supported for now.

Returns
The return value of the function call.

§ scanForResources()

def spr_pylib.train.task.PyTask.scanForResources (   self,
  resource_list 
)

Scans for resources needed by this task.

Parameters
selfThe callee object.
resource_listThe resource list with all registered resources.

§ postScan()

def spr_pylib.train.task.PyTask.postScan (   self)

Hook for tasks that want to do some extra flagging of resources, eg marking versions as deleted.