org.globus.cog.abstraction.interfaces
Interface TaskGraph

All Superinterfaces:
ExecutableObject
All Known Subinterfaces:
Queue, Set
All Known Implementing Classes:
QueueImpl, SetImpl, TaskGraphImpl

public interface TaskGraph
extends ExecutableObject

A TaskGraph provides a building block for expressing complex dependencies between tasks. All advanced applications require mechanisms to execute client-side workflows that process the tasks based on user-defined control Dependency. Hence, the TaskGraph aggregates a set of ExecutableObjects (Task or TaskGraph) and allows the user to define dependencies between these tasks. In graph theoretical terms, a TaskGraph provides the mechanism to express workflows as a hierarchical directed acyclic graph. A TaskGraph can theoretically contain infinite levels of hierarchy. However, practically it is constrained with the availability of resources (memory) on a particular system.


Field Summary
static int AbortOnFailure
          Represents a failure policy whereby the execution of the TaskGraph is aborted once any of its component Task fails.
static int ContinueOnFailure
          Represents a failure policy whereby the execution of the TaskGraph is continued even if its component Task fail.
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.ExecutableObject
TASK, TASKGRAPH
 
Method Summary
 void add(ExecutableObject graphNode)
          Adds the ExecutableObject(Task or TaskGraph) to this TaskGraph.
 void addChangeListener(ChangeListener listener)
          Adds the listener to receive graph change events produced by this TaskGraph.
 void addDependency(ExecutableObject from, ExecutableObject to)
          Adds a single dependency between the given nodes.
 boolean contains(Identity id)
          Returns a boolean indicating whether this TaskGraph contains a node with the given Identity
 Enumeration elements()
          Returns all the ExecutableObject(s) that is encapsulated by this TaskGraph.
 ExecutableObject get(Identity id)
          Returns the ExecutableObjectthat is represented by the given identity.
 int getActiveCount()
          Returns the number of ExecutableObjects that have their status as Status.ACTIVE
 Enumeration getAllAttributes()
           
 Object getAttribute(String name)
           
 int getCanceledCount()
          Returns the number of ExecutableObjects that have their status as Status.CANCELED
 int getCompletedCount()
          Returns the number of ExecutableObjects that have their status as Status.COMPLETED
 Calendar getCompletedTime()
          Returns the time when this TaskGraph was completed
 Dependency getDependency()
          Returns the dependency object associated with this TaskGraph.
 int getFailedCount()
          Returns the number of ExecutableObjects that have their status as Status.FAILED
 int getFailureHandlingPolicy()
          Returns the failure handling policy of this TaskGraph.
 int getResumedCount()
          Returns the number of ExecutableObjects that have their status as Status.RESUMED
 int getSize()
          Returns the total number of ExecutableObjectencapsulated by this TaskGraph
 int getSubmittedCount()
          Returns the number of ExecutableObjects that have their status as Status.SUBMITTED
 Calendar getSubmittedTime()
          Returns the time when this TaskGraph was submitted
 int getSuspendedCount()
          Returns the number of ExecutableObjects that have their status as Status.SUSPENDED
 int getUnsubmittedCount()
          Returns the number of ExecutableObjects that have their status as Status.UNSUBMITTED
 boolean isEmpty()
          Returns a boolean indicating whether this TaskGraph contains any node
 ExecutableObject remove(Identity id)
          Removes the ExecutableObjectthat is represented by the given identity.
 void removeChangeListener(ChangeListener listener)
          Removes the change listener for this TaskGraph.
 boolean removeDependency(ExecutableObject from, ExecutableObject to)
          Removes the dependency between the given nodes.
 void setAttribute(String name, Object value)
           
 void setDependency(Dependency dependency)
          Sets all the dependencies associated with this TaskGraph.
 void setFailureHandlingPolicy(int policy)
          Sets the policy adopted by this TaskGraph when any Task fails.
 ExecutableObject[] toArray()
          Returns all the ExecutableObject(s) that is encapsulated by this TaskGraph.
 void toXML(File file)
          Checkpoints the current state of this TaskGraph in XML format.
 
Methods inherited from interface org.globus.cog.abstraction.interfaces.ExecutableObject
addStatusListener, getIdentity, getName, getObjectType, getStatus, removeStatusListener, setIdentity, setName, setStatus, setStatus
 

Field Detail

AbortOnFailure

public static final int AbortOnFailure
Represents a failure policy whereby the execution of the TaskGraph is aborted once any of its component Task fails.

See Also:
Constant Field Values

ContinueOnFailure

public static final int ContinueOnFailure
Represents a failure policy whereby the execution of the TaskGraph is continued even if its component Task fail.

See Also:
Constant Field Values
Method Detail

add

public void add(ExecutableObject graphNode)
         throws Exception
Adds the ExecutableObject(Task or TaskGraph) to this TaskGraph. By default the added node is an unconnected node without dependencies on any of the existing nodes in this TaskGraph.

Parameters:
graphNode - an ExecutableObjectto be added as a node
Throws:
Exception

remove

public ExecutableObject remove(Identity id)
                        throws Exception
Removes the ExecutableObjectthat is represented by the given identity.

Parameters:
id - the identity of the node to be removed
Returns:
the removed ExecutableObject
Throws:
Exception

get

public ExecutableObject get(Identity id)
Returns the ExecutableObjectthat is represented by the given identity.

Parameters:
id - the identity of the node to be returned
Returns:
the ExecutableObjectrepresented by the given Identity

toArray

public ExecutableObject[] toArray()
Returns all the ExecutableObject(s) that is encapsulated by this TaskGraph.

Returns:
the array containing all the nodes of this TaskGraph

elements

public Enumeration elements()
Returns all the ExecutableObject(s) that is encapsulated by this TaskGraph.

Returns:
the enumeration containing all the nodes of this TaskGraph

setDependency

public void setDependency(Dependency dependency)
Sets all the dependencies associated with this TaskGraph.


getDependency

public Dependency getDependency()
Returns the dependency object associated with this TaskGraph.


addDependency

public void addDependency(ExecutableObject from,
                          ExecutableObject to)
Adds a single dependency between the given nodes.

Parameters:
from - the ExecutableObjectrepresenting the parent node
to - the ExecutableObjectrepresenting the child node

removeDependency

public boolean removeDependency(ExecutableObject from,
                                ExecutableObject to)
Removes the dependency between the given nodes.

Parameters:
from - the ExecutableObjectrepresenting the parent node
to - the ExecutableObjectrepresenting the child node

setAttribute

public void setAttribute(String name,
                         Object value)

getAttribute

public Object getAttribute(String name)

getAllAttributes

public Enumeration getAllAttributes()

getSize

public int getSize()
Returns the total number of ExecutableObjectencapsulated by this TaskGraph


isEmpty

public boolean isEmpty()
Returns a boolean indicating whether this TaskGraph contains any node


contains

public boolean contains(Identity id)
Returns a boolean indicating whether this TaskGraph contains a node with the given Identity

Parameters:
id - the Identity of the desired node

getUnsubmittedCount

public int getUnsubmittedCount()
Returns the number of ExecutableObjects that have their status as Status.UNSUBMITTED


getSubmittedCount

public int getSubmittedCount()
Returns the number of ExecutableObjects that have their status as Status.SUBMITTED


getActiveCount

public int getActiveCount()
Returns the number of ExecutableObjects that have their status as Status.ACTIVE


getCompletedCount

public int getCompletedCount()
Returns the number of ExecutableObjects that have their status as Status.COMPLETED


getSuspendedCount

public int getSuspendedCount()
Returns the number of ExecutableObjects that have their status as Status.SUSPENDED


getResumedCount

public int getResumedCount()
Returns the number of ExecutableObjects that have their status as Status.RESUMED


getFailedCount

public int getFailedCount()
Returns the number of ExecutableObjects that have their status as Status.FAILED


getCanceledCount

public int getCanceledCount()
Returns the number of ExecutableObjects that have their status as Status.CANCELED


toXML

public void toXML(File file)
           throws MarshalException
Checkpoints the current state of this TaskGraph in XML format. Using the TaskGraphUnmarshaller, the checkpointed TaskGraph can once again be re-instantiated.

Parameters:
file - the file to store the checkpointed task graph.
Throws:
MarshalException - during an error in XML translation.

getSubmittedTime

public Calendar getSubmittedTime()
Returns the time when this TaskGraph was submitted

Returns:
the TaskGraph submission time. null, if it is not yet submitted

getCompletedTime

public Calendar getCompletedTime()
Returns the time when this TaskGraph was completed

Returns:
the TaskGraph completion time. null, if it is not yet completed

setFailureHandlingPolicy

public void setFailureHandlingPolicy(int policy)
Sets the policy adopted by this TaskGraph when any Task fails. This policy determines the execution behaviour of the nodes dependent on the failed nodes.

For example, if the policy is AbortOnFailure, then dependents of a failed ExecutableObject are not executed at all. On the other hand, if the policy is ContinueOnFailure, then the dependents are executed irrespective to the final status of the parents.


getFailureHandlingPolicy

public int getFailureHandlingPolicy()
Returns the failure handling policy of this TaskGraph.


addChangeListener

public void addChangeListener(ChangeListener listener)
Adds the listener to receive graph change events produced by this TaskGraph. Change events are generated when an ExecutableObject is either added or removed from this TaskGraph.


removeChangeListener

public void removeChangeListener(ChangeListener listener)
Removes the change listener for this TaskGraph.