SMILA (incubation) API documentation

org.eclipse.smila.jobmanager
Interface JobManager

All Known Implementing Classes:
JobManagerImpl

public interface JobManager

JobManager service interface.


Method Summary
 void cancelJob(java.lang.String jobName, java.lang.String jobId)
           
 void deleteJobRunData(java.lang.String jobName, java.lang.String jobId)
          delete a previously completed job run.
 void finishJob(java.lang.String jobName, java.lang.String jobId)
           
 java.util.List<Task> finishTask(Task currentTask)
          Finishes a task and retrieves the following tasks.
 java.util.Collection<java.lang.String> getCompletedJobRunIds(java.lang.String jobName)
          get Ids of complete job runs.
 DefinitionPersistence getDefinitionPersistence()
           
 Task getInitialTask(java.lang.String workerName, java.lang.String id)
          Creates an initial task for input-workers.
 AnyMap getJobRunData(java.lang.String jobName, java.lang.String jobId)
           
 AnyMap getJobRunData(java.lang.String jobName, java.lang.String jobId, boolean returnDetails)
           
 JobRunInfo getJobRunInfo(java.lang.String jobName)
          get info on current job run.
 java.util.Map<java.lang.String,java.lang.String> getJobRunsUsingStore(java.lang.String storeName)
          Creates a map with job runs using the given store.
 TaskGenerator getTaskGenerator(WorkerDefinition worker)
           
 AnyMap getWorkflowRunData(java.lang.String jobName, java.lang.String jobId, java.lang.String workflowRunId)
          get information about a workflow run.
 java.lang.String startJob(java.lang.String jobName)
           
 java.lang.String startJob(java.lang.String jobName, JobRunMode jobMode)
           
 

Method Detail

startJob

java.lang.String startJob(java.lang.String jobName)
                          throws JobManagerException
Parameters:
jobName - name of the job to start
Returns:
id of the new job run
Throws:
JobManagerException - error starting job

startJob

java.lang.String startJob(java.lang.String jobName,
                          JobRunMode jobMode)
                          throws JobManagerException
Parameters:
jobName - name of the job to start
jobMode - the mode for the job to start.
Returns:
id of the new job run
Throws:
JobManagerException - error starting job

finishJob

void finishJob(java.lang.String jobName,
               java.lang.String jobId)
               throws JobManagerException
Parameters:
jobName - name of the job for which to finish the run.
jobId - id of the job run to finish
Throws:
JobManagerException - error finishing job

cancelJob

void cancelJob(java.lang.String jobName,
               java.lang.String jobId)
               throws JobManagerException
Parameters:
jobName - name of the job for which to cancel the run.
jobId - id of the job run to cancel
Throws:
JobManagerException - error canceling job

getJobRunData

AnyMap getJobRunData(java.lang.String jobName,
                     java.lang.String jobId)
                     throws JobManagerException
Parameters:
jobName - name of the job for which to monitor the run.
jobId - id of the job run to get the monitoring data. May be either the current run or a completed run.
Returns:
monitoring data for the job run with the given id.
Throws:
JobManagerException - error getting job run data

getJobRunData

AnyMap getJobRunData(java.lang.String jobName,
                     java.lang.String jobId,
                     boolean returnDetails)
                     throws JobManagerException
Parameters:
jobName - name of the job for which to monitor the run.
jobId - id of the job run to get the monitoring data. May be either the current run or a completed run.
returnDetails - whether to return details (e.g. workflow/bucket definition)
Returns:
monitoring data for the job run with the given id.
Throws:
JobManagerException - error getting job run data

getWorkflowRunData

AnyMap getWorkflowRunData(java.lang.String jobName,
                          java.lang.String jobId,
                          java.lang.String workflowRunId)
                          throws JobManagerException
get information about a workflow run.

Returns:
a map with JobManagerConstants.DATA_WORKFLOW_RUN_NO_OF_ACTIVE_TASKS and JobManagerConstants.DATA_WORKFLOW_RUN_NO_OF_TRANSIENT_BULKS. Additional keys may be added.
Throws:
JobManagerException - jobrun or workflowrun are not active anymore.

getJobRunInfo

JobRunInfo getJobRunInfo(java.lang.String jobName)
                         throws JobManagerException
get info on current job run.

Parameters:
jobName - job name
Returns:
if job is defined and active: id and state of current run. Else null.
Throws:
JobManagerException - error getting state.

getCompletedJobRunIds

java.util.Collection<java.lang.String> getCompletedJobRunIds(java.lang.String jobName)
                                                             throws JobManagerException
get Ids of complete job runs.

Parameters:
jobName - job name
Returns:
Ids of completed job runs, sorted lexicographically ascending. Empty set if job is not defined or no completed job runs exists.
Throws:
JobManagerException - error getting state.

deleteJobRunData

void deleteJobRunData(java.lang.String jobName,
                      java.lang.String jobId)
                      throws JobManagerException
delete a previously completed job run.

Parameters:
jobName - name of the job for which to monitor the run.
jobId - id of the complete job run to delete the monitoring data.
Throws:
JobManagerException - run id is not a completed run or error deleting it.

getDefinitionPersistence

DefinitionPersistence getDefinitionPersistence()
Returns:
the DefinitionPersistence reference.

getTaskGenerator

TaskGenerator getTaskGenerator(WorkerDefinition worker)
Parameters:
worker - The worker
Returns:
The matching task generator

finishTask

java.util.List<Task> finishTask(Task currentTask)
                                throws JobManagerException
Finishes a task and retrieves the following tasks. Dependent on the resultDescription job manager can decide what to do.

Parameters:
currentTask - The finished task.
Returns:
A list of follow up tasks. If there are no follow-up tasks, an empty list will be generated.
Throws:
JobManagerException - error while trying to finish the task.

getInitialTask

Task getInitialTask(java.lang.String workerName,
                    java.lang.String id)
                    throws JobManagerException
Creates an initial task for input-workers.

Parameters:
workerName - The name of the worker for which this task is requested.
id - The id of the task-source (e.g. index name, job id, ...) for which the task is requested. The TaskProducer and the worker requester of the tasks should have a common understanding of what this id is about.
Returns:
A task for the worker or null if task delivery is currently not allowed for this id.
Throws:
JobManagerException - error while trying to generate initial task. The job has not the correct state or the worker is not an startAction worker.

getJobRunsUsingStore

java.util.Map<java.lang.String,java.lang.String> getJobRunsUsingStore(java.lang.String storeName)
Creates a map with job runs using the given store.

Parameters:
storeName - the store name
Returns:
a map with all job runs using the store with given name. The job name is used as key, the job run id as value.

SMILA (incubation) API documentation