com.parabon.client
Interface TaskEvent

All Known Subinterfaces:
TaskCheckpointEvent, TaskExceptionEvent, TaskIntermediateResultEvent, TaskProgressEvent, TaskResultEvent

public interface TaskEvent

Base interface for all task events. Provides the client application with access to all relevant information pertaining to the task that caused this event to be returned. Not all events generated are the direct result of action on the task's part, but the 'last known state' of a task can also be used to generate an event when triggered by some condition in the engine or Frontier server. Likewise, not all information reported by tasks will be propogated back to the client application as events; in fact, in many circumstances, only a small fraction of events will ever be reported to listeners. Further, while events tend to be reported sequentially (that is, the order of reporting tends to be the order in which they were generated), it is not guaranteed that all tasks are generated by the same instance of a task. For example, a task might be run on two nodes simultaneously, and the events from each could be intertwined. This effect can be mitigated by tasks which (1) are fully deterministic and (2) report progress reliably.

See Also:
TaskEventListener, TaskResultEvent, TaskExceptionEvent, TaskProgressEvent, TaskIntermediateResultEvent, TaskCheckpointEvent

Method Summary
 double getProgress()
          Get the progress value associated with this event -- that is, the last progress value the task had reported at the time this even was generated.
 TaskRunMode getRunMode()
          Get the run mode of the task when this event was generated, if known.
 java.util.Map<java.lang.String,java.lang.String> getTaskAttributes()
          Get the attribute map associated with this task.
 TaskProxy getTaskProxy()
          Return a TaskProxy object which can be used to query and manipulate the running task.
 boolean isActive()
          Convenience routing to examine the run mode and determine whether this task was actively executing when this event was generated.
 boolean isComplete()
          Convenience routine to examine the run mode and determine whether the task had finished executing when this event was generated.
 

Method Detail

getTaskProxy

TaskProxy getTaskProxy()
Return a TaskProxy object which can be used to query and manipulate the running task. The returned TaskProxy remains valid until either the task, the job, or the session is destroyed.


getTaskAttributes

java.util.Map<java.lang.String,java.lang.String> getTaskAttributes()
Get the attribute map associated with this task. The returned map remains valid indefinitely, but should not be modified; any attempt to do so will result in undefined behavior.


getRunMode

TaskRunMode getRunMode()
Get the run mode of the task when this event was generated, if known.


isActive

boolean isActive()
Convenience routing to examine the run mode and determine whether this task was actively executing when this event was generated. If the run mode is unknown, then isActive() returns true.


isComplete

boolean isComplete()
Convenience routine to examine the run mode and determine whether the task had finished executing when this event was generated. If the run mode is unknown, then isActive() returns true.


getProgress

double getProgress()
Get the progress value associated with this event -- that is, the last progress value the task had reported at the time this even was generated. Returns -1 if no progress was ever reported by the task or if progress is unknown.