tassl.application.cometcloud
Class WorkflowMaster

java.lang.Object
  extended by java.lang.Thread
      extended by tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
          extended by tassl.application.cometcloud.WorkflowMaster
All Implemented Interfaces:
java.lang.Runnable, tassl.automate.programmodel.masterworker.MasterFramework

public class WorkflowMaster
extends tassl.automate.programmodel.masterworker.simpleapi.GenericMaster

Task Manager


Nested Class Summary
 
Nested classes/interfaces inherited from class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
tassl.automate.programmodel.masterworker.simpleapi.GenericMaster.TaskGenerateThread
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
confirmedPoisonPill, jobDone, masterNetName, numFinishedTask, numoftasks, numPoisonPill, overlays, peerIP, taskstatus
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WorkflowMaster()
           
 
Method Summary
 boolean checkIfDuplicatedTask(java.util.List<java.lang.Integer> tasksOfStage, TaskProperties newTask)
           
 boolean checkStageDone(java.lang.String wfkStageId)
          Check if a stage is done.
 void checkStageDoneNoNewTask(java.lang.String wfkStageId)
          Check if a stage is done when a task does not generate tasks of the following stage.
protected  void cleanStages(java.lang.String wfkStageId)
          Remove information of stages.
 tassl.automate.comet.XmlTuple createPoisonTaskTuple(int id)
           
 java.lang.Object createTaskData(int taskid)
          This method is called from insertTask to create the data associated to the task
 tassl.automate.comet.XmlTuple createTaskTuple(int taskid)
          Check recursively if following Non-blocking stages are done
protected  java.lang.Object[] findOriginalStageNonBlocking(java.lang.String wfkStageId)
          Find stage that originated the non-blocking transitions.
 void generateTasks()
          This method is called to read the application properties and initiate the tasks creation.
 java.lang.String getAllDoneTasks(java.lang.String wfkStageId)
          Retrieve the ids of the tasks that have been completed.
 java.lang.String getWkfStageId(int taskid)
          Find stage that a task is part of
 java.lang.Object readObject(java.io.DataInputStream in)
           
 boolean setResultSpecific(int taskid, java.lang.Object data, java.lang.String message, java.lang.String sender)
          This method is called when a worker return a result
 boolean tasksCompleted(java.lang.String wfkStageId)
          Check if this stage has all tasks completed
 
Methods inherited from class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
confirmWorkerLeave, countFinishedTasks, GenericMaster, getCspace, getData, getNumOfTasks, getPeerIP, getTaskStatus, getTaskStatus, getWorkerid, insertTask, isJobDone, quit, reinsertTask, removeNodes, run, setCometEnv, setJobDone, setNumOfTasks, setResult, setTaskStatus, startMaster, waitMaster, waitMonitoring
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkflowMaster

public WorkflowMaster()
Method Detail

generateTasks

public void generateTasks()
This method is called to read the application properties and initiate the tasks creation.

Specified by:
generateTasks in class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster

checkIfDuplicatedTask

public boolean checkIfDuplicatedTask(java.util.List<java.lang.Integer> tasksOfStage,
                                     TaskProperties newTask)

readObject

public java.lang.Object readObject(java.io.DataInputStream in)

createTaskData

public java.lang.Object createTaskData(int taskid)
This method is called from insertTask to create the data associated to the task

Specified by:
createTaskData in class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
Parameters:
taskid - Task identifier that can be use as index to create its data.
Returns:
Object input data that will be attached to the task. The object has to be serializable.

setResultSpecific

public boolean setResultSpecific(int taskid,
                                 java.lang.Object data,
                                 java.lang.String message,
                                 java.lang.String sender)
This method is called when a worker return a result

Specified by:
setResultSpecific in class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
Parameters:
taskid - Task identifier that can be use as index to create its data.
data - Object with the returned data
message - Additional information send by the worker
sender - Name of the worker

checkStageDoneNoNewTask

public void checkStageDoneNoNewTask(java.lang.String wfkStageId)
Check if a stage is done when a task does not generate tasks of the following stage. (non-blocking stages) e.g., a task from S1 does not generate new task of S2 (S2 has non-blocking dependency with S1). So we need to check if S2 is done


findOriginalStageNonBlocking

protected java.lang.Object[] findOriginalStageNonBlocking(java.lang.String wfkStageId)
Find stage that originated the non-blocking transitions. This is required because scheduling is done by adding tasks to the original one to reuse resources It also returns the % of objective this stage can release. 100% means that previous stages are completed and this stage should be able to generate all its tasks e.g., S1-S2 is non-blocking, S2-S3 is non-blocking, S4-S5 is nonblocking calling with S1, return S1 calling with S2, return S1 calling with S3, return S1 calling with S4, return S4 calling with S5, return S4

Parameters:
wfkStageId -
Returns:
[OriginalWkflStageId, %tasksReleased]

getWkfStageId

public java.lang.String getWkfStageId(int taskid)
Find stage that a task is part of

Parameters:
taskid -
Returns:
workflowId.stageId

cleanStages

protected void cleanStages(java.lang.String wfkStageId)
Remove information of stages. If Non-blocking transition involved, then it removes all stages involved in the non-blocking transitions.

Parameters:
wfkStageId -

checkStageDone

public boolean checkStageDone(java.lang.String wfkStageId)
Check if a stage is done. A stage is done when all its tasks are completed and If the stage has a non-blocking transition, the stage following the non-blocking transition has to be done if non-blocking transition involved call findOriginalStageNonBlocking to 1. find first stage that was not originated from non-blocking transitions 2. Know if I am 100% completed. If I am completed and I do not have a non-blocking transition after me, and all following Non-blocking stages are done, then original stage is notified as done. 3. We assume that in the workflowManager and AutonomicScheduler will set to done all stages after this one whose transitions are non-blocking

Parameters:
stageId - it is workflowId.stageId
Returns:

tasksCompleted

public boolean tasksCompleted(java.lang.String wfkStageId)
Check if this stage has all tasks completed

Parameters:
wfkStageId -
Returns:

createTaskTuple

public tassl.automate.comet.XmlTuple createTaskTuple(int taskid)
Check recursively if following Non-blocking stages are done

Overrides:
createTaskTuple in class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster
Parameters:
wfkStageId -
Returns:

createPoisonTaskTuple

public tassl.automate.comet.XmlTuple createPoisonTaskTuple(int id)
Overrides:
createPoisonTaskTuple in class tassl.automate.programmodel.masterworker.simpleapi.GenericMaster

getAllDoneTasks

public java.lang.String getAllDoneTasks(java.lang.String wfkStageId)
Retrieve the ids of the tasks that have been completed. if non-blocking transitions are involve, we return status of following stages too

Parameters:
wkflId.stageId -
Returns: