tassl.application.cometcloud
Class WorkflowMeteorGenericWorker

java.lang.Object
  extended by tassl.application.cometcloud.WorkflowMeteorGenericWorker
All Implemented Interfaces:
tassl.automate.meteor.application.MeteorWorkerFramework, tassl.automate.meteor.MeteorNotifier, tassl.automate.programmodel.masterworker.WorkerFramework
Direct Known Subclasses:
AppWorker, AppWorker, AppWorker, AppWorkerMontage

public abstract class WorkflowMeteorGenericWorker
extends java.lang.Object
implements tassl.automate.meteor.application.MeteorWorkerFramework, tassl.automate.meteor.MeteorNotifier


Field Summary
 tassl.automate.application.network.Sender sender
           
 
Constructor Summary
WorkflowMeteorGenericWorker()
           
 
Method Summary
abstract  void cancelJob()
           
 java.lang.Object computeTask(java.lang.Object obj)
           
abstract  java.lang.Object computeTaskSpecific(java.lang.Object dataobj, WorkflowTaskTuple tasktupl)
          Process the tasks.
 void consumeTask(tassl.automate.comet.XmlTuple tup)
           
 java.lang.String getAppName()
           
 java.lang.String getFile(java.lang.Boolean useLocalCache, java.lang.String remotedir, java.util.List files, java.lang.String dirInWorker)
          Retrieve input files to the local worker.
 int getInitialTaskCount()
           
 int getMasterPort()
           
 java.lang.String getPeerIP()
           
 java.lang.String getRequirement()
           
 java.lang.String getResultAddress()
           
 java.lang.String getStageID()
           
 tassl.automate.comet.XmlTuple getTemplateQuery()
           
 java.lang.String getWfManagerName()
           
 int getWorkerid()
           
 java.lang.String getWorkflowID()
           
 void loadParams()
           
 void MeteorGenericWorker()
           
 void meteorNotifyNode(tassl.automate.comet.XmlTuple tup)
           
 void meteorSubscribe(int ttl)
           
 void meteorUnsubscribe()
           
 java.lang.String putFile(java.lang.String remotedir, java.util.List files, java.lang.String dirInWorker)
          Upload a file to a specific machine and directory.
 void quit()
           
 void sendResultToMaster(int taskid, java.lang.Object data, java.lang.String message, java.lang.String masterName)
           
 void setAppName(java.lang.String name)
           
 void setCometEnv(tassl.automate.comet.CometSpace space, int workerID, java.lang.String peerIPaddr, tassl.automate.overlay.OverlayService overlay)
           
 void setInitialTaskCount(int value)
           
 void setMeteorEnv(tassl.automate.meteor.Meteor space, int workerID, java.lang.String peerIPaddr, tassl.automate.overlay.OverlayService overlay)
           
 void setPeerIP(java.lang.String publicAddress)
           
 void setRequirement(java.lang.String req)
           
 void setResultAddress(java.lang.String address)
           
 void setResultPort(int port)
           
 void setStageID(java.lang.String stageID)
           
 void setTaskids(java.lang.String taskids)
           
 void setWfManagerName(java.lang.String wfManagerName)
           
 void setWorkflowID(java.lang.String workflowID)
           
 void startWorker()
           
protected  java.util.List<FileProperties> uploadResults(java.util.List<java.lang.String> outputfiles, java.lang.String workingdir, FileProperties outputFP)
          Upload results to the destination and create the list of result files
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sender

public tassl.automate.application.network.Sender sender
Constructor Detail

WorkflowMeteorGenericWorker

public WorkflowMeteorGenericWorker()
Method Detail

getResultAddress

public java.lang.String getResultAddress()

getMasterPort

public int getMasterPort()

setResultAddress

public void setResultAddress(java.lang.String address)

setResultPort

public void setResultPort(int port)

getWfManagerName

public java.lang.String getWfManagerName()

getWorkflowID

public java.lang.String getWorkflowID()

getStageID

public java.lang.String getStageID()

setWfManagerName

public void setWfManagerName(java.lang.String wfManagerName)

setWorkflowID

public void setWorkflowID(java.lang.String workflowID)

setStageID

public void setStageID(java.lang.String stageID)

getAppName

public java.lang.String getAppName()

getRequirement

public java.lang.String getRequirement()

setAppName

public void setAppName(java.lang.String name)

setRequirement

public void setRequirement(java.lang.String req)

setTaskids

public void setTaskids(java.lang.String taskids)

getInitialTaskCount

public int getInitialTaskCount()

setInitialTaskCount

public void setInitialTaskCount(int value)

MeteorGenericWorker

public void MeteorGenericWorker()

loadParams

public void loadParams()

getPeerIP

public java.lang.String getPeerIP()

getWorkerid

public int getWorkerid()

setPeerIP

public void setPeerIP(java.lang.String publicAddress)

setMeteorEnv

public void setMeteorEnv(tassl.automate.meteor.Meteor space,
                         int workerID,
                         java.lang.String peerIPaddr,
                         tassl.automate.overlay.OverlayService overlay)
Specified by:
setMeteorEnv in interface tassl.automate.meteor.application.MeteorWorkerFramework

computeTask

public java.lang.Object computeTask(java.lang.Object obj)
Specified by:
computeTask in interface tassl.automate.programmodel.masterworker.WorkerFramework

quit

public void quit()
Specified by:
quit in interface tassl.automate.programmodel.masterworker.WorkerFramework

sendResultToMaster

public void sendResultToMaster(int taskid,
                               java.lang.Object data,
                               java.lang.String message,
                               java.lang.String masterName)
Specified by:
sendResultToMaster in interface tassl.automate.programmodel.masterworker.WorkerFramework

startWorker

public void startWorker()
Specified by:
startWorker in interface tassl.automate.programmodel.masterworker.WorkerFramework

meteorSubscribe

public void meteorSubscribe(int ttl)

meteorUnsubscribe

public void meteorUnsubscribe()

meteorNotifyNode

public void meteorNotifyNode(tassl.automate.comet.XmlTuple tup)
Specified by:
meteorNotifyNode in interface tassl.automate.meteor.MeteorNotifier

consumeTask

public void consumeTask(tassl.automate.comet.XmlTuple tup)
Specified by:
consumeTask in interface tassl.automate.meteor.MeteorNotifier

setCometEnv

public void setCometEnv(tassl.automate.comet.CometSpace space,
                        int workerID,
                        java.lang.String peerIPaddr,
                        tassl.automate.overlay.OverlayService overlay)
Specified by:
setCometEnv in interface tassl.automate.programmodel.masterworker.WorkerFramework

getTemplateQuery

public tassl.automate.comet.XmlTuple getTemplateQuery()
Specified by:
getTemplateQuery in interface tassl.automate.programmodel.masterworker.WorkerFramework

getFile

public java.lang.String getFile(java.lang.Boolean useLocalCache,
                                java.lang.String remotedir,
                                java.util.List files,
                                java.lang.String dirInWorker)
Retrieve input files to the local worker.

Parameters:
useLocalCache - Whether we check in the Agent local storage for the a copy of the file or not.
remotedir - Address and Directory where the original file is stored.
files - List of files to be retrieved.
dirInWorker - Directory where we want to have the file in our local worker.
Returns:
String with OK or ERROR:message

putFile

public java.lang.String putFile(java.lang.String remotedir,
                                java.util.List files,
                                java.lang.String dirInWorker)
Upload a file to a specific machine and directory.

Parameters:
remotedir - Address and Directory to store the file.
files - List of files to be stored.
dirInWorker - Directory where the files are in our local worker.
Returns:
String with OK or ERROR:message

uploadResults

protected java.util.List<FileProperties> uploadResults(java.util.List<java.lang.String> outputfiles,
                                                       java.lang.String workingdir,
                                                       FileProperties outputFP)
Upload results to the destination and create the list of result files

Parameters:
outputfiles - Name of generated files
workingdir - Directory where files are located
outputFP - Destination of the results. If location is empty then they are left in the staging area of the site.
Returns:
List of result FileProperty

computeTaskSpecific

public abstract java.lang.Object computeTaskSpecific(java.lang.Object dataobj,
                                                     WorkflowTaskTuple tasktupl)
Process the tasks. It is called after computeTask retrieve the data associated with the task

Parameters:
dataobj - Data Object with the data associated to the tuple. It is typically a List and it was created during task creation.
tasktupl - TaskTuple object with the properties of the task.
Returns:
Object to return to the master once the task is done.

cancelJob

public abstract void cancelJob()