SMILA (incubation) API documentation

org.eclipse.smila.jobmanager.internal
Class JobRun

java.lang.Object
  extended by org.eclipse.smila.jobmanager.internal.JobRun

public class JobRun
extends java.lang.Object

Class representing the data for a job run (the JobDefinition, the WorkflowDefinition, WorkerDefinitions, Buckets, etc.).


Constructor Summary
JobRun(java.lang.String runId, java.lang.String jobName, RunStorage runStorage, DefinitionPersistence definitions, TaskGeneratorProvider taskGeneratorProvider)
          Constructs the job run data for a job run.
 
Method Summary
 Bucket getBucket(java.lang.String bucketName)
           
 Bucket getBucketForInputSlot(WorkflowAction action, java.lang.String slotName)
           
 Bucket getBucketForOutputSlot(WorkflowAction action, java.lang.String slotName)
           
 java.util.Collection<Bucket> getBuckets()
           
 java.util.List<Task> getFollowupTasks(java.lang.String workflowRunId, MultiValueMap<java.lang.String,BulkInfo> bucketNameToReallyCreatedBulksMap, java.util.Map<java.lang.String,java.lang.String> taskParamsToCopy)
          Gets the follow-up tasks for workers within the actual workflow run depending on a list of bulks.
 java.util.List<Task> getInitialRunOnceTasks(java.lang.String workflowRunId)
          get initial tasks for run once job run.
 Task getInitialTask(java.lang.String workerName, java.lang.String workflowRunId)
          Creates the initial task for this job run's new workflow run.
 JobDefinition getJobDefinition()
           
 java.lang.String getJobName()
           
 java.lang.String getJobRunId()
           
 java.util.Collection<Bucket> getTriggerBuckets()
           
 java.util.List<Task> getTriggeredInitialTasks(MultiValueMap<java.lang.String,BulkInfo> bucketNameToReallyCreatedBulksMap)
          Gets the follow-up tasks for workers within the actual workflow run depending on a list of bulks.
 WorkerDefinition getWorkerDefinition(java.lang.String workerName)
           
 WorkflowDefinition getWorkflowDefinition()
           
 boolean isTriggeredBy(Bucket triggeringBucket)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobRun

public JobRun(java.lang.String runId,
              java.lang.String jobName,
              RunStorage runStorage,
              DefinitionPersistence definitions,
              TaskGeneratorProvider taskGeneratorProvider)
       throws java.lang.Exception
Constructs the job run data for a job run.

Parameters:
runId - the id of the run.
jobName - The job name.
runStorage - The runStorage.
definitions - The DefinitionPersistence where the definitions can be retrieved (e.g. WorkerDefinition).
taskGeneratorProvider - The TaskGeneratorProvider is used to select a TaskGenerator for generating new tasks
Throws:
java.lang.Exception - An exception if something goes wrong
Method Detail

getWorkerDefinition

public WorkerDefinition getWorkerDefinition(java.lang.String workerName)
Parameters:
workerName - The name of the WorkerDefinition.
Returns:
The WorkerDefinition with the name workerName.

getJobName

public java.lang.String getJobName()
Returns:
name of job definition

getJobRunId

public java.lang.String getJobRunId()
Returns:
The ID of the job run.

getJobDefinition

public JobDefinition getJobDefinition()
Returns:
The JobDefinition for the JobRun.

getWorkflowDefinition

public WorkflowDefinition getWorkflowDefinition()
Returns:
The WorkflowDefinition for the JobRun.

getBuckets

public java.util.Collection<Bucket> getBuckets()
Returns:
The Collection of Bucket instances of the JobRun.

getBucket

public Bucket getBucket(java.lang.String bucketName)
Parameters:
bucketName - the bucket's name.
Returns:
the job's Bucket instance for a bucket with the given name

getBucketForInputSlot

public Bucket getBucketForInputSlot(WorkflowAction action,
                                    java.lang.String slotName)
Parameters:
action - the action for which the input bucket should be looked up.
slotName - an input slot name of this worker
Returns:
the associated bucket, or null, if worker is not used in workflow, or the slot name is not an input slot.

getBucketForOutputSlot

public Bucket getBucketForOutputSlot(WorkflowAction action,
                                     java.lang.String slotName)
Parameters:
action - the action for which the input bucket should be looked up.
slotName - an output slot name of this worker
Returns:
the associated bucket, or null, if worker is not used in workflow, or the slot name is not an output slot.

getInitialTask

public Task getInitialTask(java.lang.String workerName,
                           java.lang.String workflowRunId)
                    throws JobManagerException
Creates the initial task for this job run's new workflow run.

Parameters:
workerName - The name of the worker requesting the initial task.
workflowRunId - The id for the new workflow run.
Returns:
An initial task for the new job run.
Throws:
JobManagerException - An error occurred while checking if an initial task could be created or while creating the initial task.

getFollowupTasks

public java.util.List<Task> getFollowupTasks(java.lang.String workflowRunId,
                                             MultiValueMap<java.lang.String,BulkInfo> bucketNameToReallyCreatedBulksMap,
                                             java.util.Map<java.lang.String,java.lang.String> taskParamsToCopy)
                                      throws TaskGeneratorException
Gets the follow-up tasks for workers within the actual workflow run depending on a list of bulks.

Parameters:
workflowRunId - The id of the current workflow run.
bucketNameToReallyCreatedBulksMap - The bulks potentially triggering tasks for follow up workers.
taskParamsToCopy - the parameters from the current task to copy to the follow up tasks
Returns:
A collection of tasks triggered by the bulks within this workflow for the given workflow run.
Throws:
TaskGeneratorException - error while generating new tasks

getInitialRunOnceTasks

public java.util.List<Task> getInitialRunOnceTasks(java.lang.String workflowRunId)
                                            throws TaskGeneratorException
get initial tasks for run once job run.

Throws:
TaskGeneratorException

isTriggeredBy

public boolean isTriggeredBy(Bucket triggeringBucket)
Parameters:
triggeringBucket - a bucket changed by another workflow
Returns:
true if this job run can be triggered by this bucket.

getTriggerBuckets

public java.util.Collection<Bucket> getTriggerBuckets()
Returns:
persistent input buckets of start action.

getTriggeredInitialTasks

public java.util.List<Task> getTriggeredInitialTasks(MultiValueMap<java.lang.String,BulkInfo> bucketNameToReallyCreatedBulksMap)
                                              throws TaskGeneratorException
Gets the follow-up tasks for workers within the actual workflow run depending on a list of bulks. Note that all tasks returned by this method will have thir workflowRunId parameter set to "null" since there will be no workflow run started. You will have to set this parameter for any task in the returned collection.

Parameters:
bucketNameToReallyCreatedBulksMap - The bulks potentially triggering tasks for follow up workers.
Returns:
A collection of tasks triggered by the bulks within this workflow for the given workflow run.
Throws:
TaskGeneratorException - error while generating new tasks

SMILA (incubation) API documentation