SMILA 1.0 API documentation

org.eclipse.smila.taskmanager
Class Task

java.lang.Object
  extended by org.eclipse.smila.taskmanager.Task

public class Task
extends java.lang.Object

Task class.


Field Summary
static java.lang.String KEY_INPUT
          The key for the input.
static java.lang.String KEY_OUTPUT
          The key for the output.
static java.lang.String KEY_PARAMETERS
          The key for the parameters.
static java.lang.String KEY_PROPERTIES
          The key for the properties.
static java.lang.String KEY_QUALIFIER
          The key for the qualifier.
static java.lang.String KEY_RESULT_DESCRIPTION
          The key for the result description.
static java.lang.String KEY_TASK_ID
          The key for the task id.
static java.lang.String KEY_WORKER_NAME
          The key for the worker name.
static java.lang.String PROPERTY_CREATED_TIME
          key name for task creation time.
static java.lang.String PROPERTY_END_TIME
          key name for task end time.
static java.lang.String PROPERTY_JOB_NAME
          The key for the job name in the task properties.
static java.lang.String PROPERTY_JOB_RUN_ID
          The key for the job run id in the task properties.
static java.lang.String PROPERTY_ORIGINAL_QUALIFIER
          the original qualifier to temporarily store the tasks qualifier.
static java.lang.String PROPERTY_ORIGINAL_WORKER
          the original qualifier to temporarily store the tasks qualifier.
static java.lang.String PROPERTY_POSTPONED
          key name for postponed, how often is the task postponed.
static java.lang.String PROPERTY_RECOVERABLE
          The key whether a task is recoverable in the task properties.
static java.lang.String PROPERTY_START_TIME
          key name for task start time.
static java.lang.String PROPERTY_WORKER_HOST
          The key for the worker host in the task properties.
static java.lang.String PROPERTY_WORKFLOW_RUN_ID
          The key for the job id in the task properties.
static java.lang.String PROPERY_TASK_AGE
          difference between createdTime and startTime in milliseconds, computed when the task is retrieved by a worker.
 
Constructor Summary
Task(java.lang.String taskId, java.lang.String workerName)
          Constructs a new Task.
 
Method Summary
 Task createFinishTask(ResultDescription result, java.lang.String finishWorkerName)
          save worker name and qualifier to properties and set worker name to finish worker.
 Task createRetryTask(java.lang.String taskId)
          Constructs a new Task from an existing Task with empty ResultDescription and own task id for retrying (the qualifier is restored from PROPERTY_ORIGINAL_QUALIFIER property.
static Task fromAny(Any any)
          parse task from any.
 java.util.Map<java.lang.String,java.util.List<BulkInfo>> getInputBulks()
           
 java.util.Map<java.lang.String,java.util.List<BulkInfo>> getOutputBulks()
           
 AnyMap getParameters()
           
 java.util.Map<java.lang.String,java.lang.String> getProperties()
           
 java.lang.String getQualifier()
           
 ResultDescription getResultDescription()
           
 java.lang.String getTaskId()
           
 java.lang.String getWorkerName()
           
 void setQualifier(java.lang.String qualifier)
           
 void setTaskCreatedProperties()
          set PROPERTY_CREATED_TIME if not set already and it's not a finishing task.
 void setTaskStartedProperties()
          set PROPERTY_START_TIME and , if it's not a finishing task.
 AnyMap toAny()
          Returns the task as an Any representation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_JOB_NAME

public static final java.lang.String PROPERTY_JOB_NAME
The key for the job name in the task properties.

See Also:
Constant Field Values

PROPERTY_JOB_RUN_ID

public static final java.lang.String PROPERTY_JOB_RUN_ID
The key for the job run id in the task properties.

See Also:
Constant Field Values

PROPERTY_WORKFLOW_RUN_ID

public static final java.lang.String PROPERTY_WORKFLOW_RUN_ID
The key for the job id in the task properties.

See Also:
Constant Field Values

PROPERTY_WORKER_HOST

public static final java.lang.String PROPERTY_WORKER_HOST
The key for the worker host in the task properties.

See Also:
Constant Field Values

PROPERTY_RECOVERABLE

public static final java.lang.String PROPERTY_RECOVERABLE
The key whether a task is recoverable in the task properties.

See Also:
Constant Field Values

PROPERTY_ORIGINAL_QUALIFIER

public static final java.lang.String PROPERTY_ORIGINAL_QUALIFIER
the original qualifier to temporarily store the tasks qualifier.

See Also:
Constant Field Values

PROPERTY_ORIGINAL_WORKER

public static final java.lang.String PROPERTY_ORIGINAL_WORKER
the original qualifier to temporarily store the tasks qualifier.

See Also:
Constant Field Values

PROPERTY_START_TIME

public static final java.lang.String PROPERTY_START_TIME
key name for task start time.

See Also:
Constant Field Values

PROPERTY_END_TIME

public static final java.lang.String PROPERTY_END_TIME
key name for task end time.

See Also:
Constant Field Values

PROPERTY_CREATED_TIME

public static final java.lang.String PROPERTY_CREATED_TIME
key name for task creation time.

See Also:
Constant Field Values

PROPERY_TASK_AGE

public static final java.lang.String PROPERY_TASK_AGE
difference between createdTime and startTime in milliseconds, computed when the task is retrieved by a worker.

See Also:
Constant Field Values

PROPERTY_POSTPONED

public static final java.lang.String PROPERTY_POSTPONED
key name for postponed, how often is the task postponed.

See Also:
Constant Field Values

KEY_TASK_ID

public static final java.lang.String KEY_TASK_ID
The key for the task id.

See Also:
Constant Field Values

KEY_WORKER_NAME

public static final java.lang.String KEY_WORKER_NAME
The key for the worker name.

See Also:
Constant Field Values

KEY_QUALIFIER

public static final java.lang.String KEY_QUALIFIER
The key for the qualifier.

See Also:
Constant Field Values

KEY_PROPERTIES

public static final java.lang.String KEY_PROPERTIES
The key for the properties.

See Also:
Constant Field Values

KEY_PARAMETERS

public static final java.lang.String KEY_PARAMETERS
The key for the parameters.

See Also:
Constant Field Values

KEY_INPUT

public static final java.lang.String KEY_INPUT
The key for the input.

See Also:
Constant Field Values

KEY_OUTPUT

public static final java.lang.String KEY_OUTPUT
The key for the output.

See Also:
Constant Field Values

KEY_RESULT_DESCRIPTION

public static final java.lang.String KEY_RESULT_DESCRIPTION
The key for the result description.

See Also:
Constant Field Values
Constructor Detail

Task

public Task(java.lang.String taskId,
            java.lang.String workerName)
Constructs a new Task.

Parameters:
taskId - The task id.
workerName - The name of the worker for this task.
Method Detail

createRetryTask

public Task createRetryTask(java.lang.String taskId)
Constructs a new Task from an existing Task with empty ResultDescription and own task id for retrying (the qualifier is restored from PROPERTY_ORIGINAL_QUALIFIER property.

Note: the bulks and parameters are copied, as well as the properties.

Parameters:
taskId - the task id for the new task.

createFinishTask

public Task createFinishTask(ResultDescription result,
                             java.lang.String finishWorkerName)
save worker name and qualifier to properties and set worker name to finish worker.


fromAny

public static Task fromAny(Any any)
                    throws AnyConvertException
parse task from any.

Parameters:
any - Any representation of task, expected to be an AnyMap
Returns:
parsed task.
Throws:
AnyConvertException - an exception during conversion from Any

getTaskId

public java.lang.String getTaskId()
Returns:
the taskId

getWorkerName

public java.lang.String getWorkerName()
Returns:
the workerName

getQualifier

public java.lang.String getQualifier()
Returns:
qualifier value, if set. Else null.

setQualifier

public void setQualifier(java.lang.String qualifier)
Parameters:
qualifier - new qualifier.

getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
Returns:
the properties

getParameters

public AnyMap getParameters()
Returns:
the parameters

getInputBulks

public java.util.Map<java.lang.String,java.util.List<BulkInfo>> getInputBulks()
Returns:
the inputBulks

getOutputBulks

public java.util.Map<java.lang.String,java.util.List<BulkInfo>> getOutputBulks()
Returns:
the outputBulks

getResultDescription

public ResultDescription getResultDescription()
Returns:
the result description (which is only set for a finished task)

setTaskCreatedProperties

public void setTaskCreatedProperties()
set PROPERTY_CREATED_TIME if not set already and it's not a finishing task.


setTaskStartedProperties

public void setTaskStartedProperties()
set PROPERTY_START_TIME and , if it's not a finishing task.


toAny

public AnyMap toAny()
Returns the task as an Any representation. If "parameters" are set to null it will not be guaranteed if the "parameters" property will be present in the resulting Any with a value of null or if it will not be present at all.

Returns:
Any object describing this task.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SMILA 1.0 API documentation