com.parabon.client
Class TaskSpec

java.lang.Object
  extended by com.parabon.client.TaskSpec
Direct Known Subclasses:
GenericTaskSpec, SerializableTaskSpec

public class TaskSpec
extends java.lang.Object

TaskSpec encapsulates all information needed to create a task and define its initial state: its initial parameters, task-level elements, a list of required elements, and its runnable class. After defining a complete TaskSpec, it can be passed to Job.addTask() to define a new task and obtain a TaskProxy through which the task can be monitored and controlled.

See Also:
Job, TaskProxy

Nested Class Summary
static class TaskSpec.ExternalPackage
           
static class TaskSpec.NetworkTypeConstraint
           
static class TaskSpec.SchedulingConstraints
           
 
Constructor Summary
TaskSpec(Job job, java.lang.String taskID)
           
TaskSpec(Job job, java.lang.String taskID, TaskSpec other)
           
TaskSpec(TaskSpec other)
           
 
Method Summary
 java.net.URI addElement(com.parabon.io.DataWrapper contents)
          Create a task-level element which can be referred to only in this task.
 java.net.URI addElement(java.io.File contents)
          Create a task-level element which can be referred to only in this task.
 java.net.URI addElement(java.lang.String identifier, com.parabon.io.DataWrapper contents)
          Create a task-level element which can be referred to only in this task.
 java.net.URI addElement(java.lang.String identifier, java.io.File contents)
          Create a task-level element which can be referred to only in this task.
 java.net.URI addElementBundle(com.parabon.io.DataWrapper contents)
          Create a task-level element bundle containing elements which can be referred to only in this task.
 java.net.URI addElementBundle(java.io.File contents)
          Create a task-level element bundle containing elements which can be referred to only in this task.
 java.net.URI addElementBundle(java.lang.String identifier, com.parabon.io.DataWrapper contents)
          Create a task-level element bundle containing elements which can be referred to only in this task.
 java.net.URI addElementBundle(java.lang.String identifier, java.io.File contents)
          Create a task-level element bundle containing elements which can be referred to only in this task.
 void addRequiredElement(java.net.URI uri)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElement(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> metadata)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElementAsClasspathJar(java.net.URI uri)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElementAsClasspathJar(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> metadata)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElementAsNativeLibrary(java.net.URI uri)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElementAsNativeLibrary(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> metadata)
          Specify that the element referenced by this URI is required in the execution of this particular task.
 void addRequiredElementBundle(java.net.URI bundleURI, com.parabon.io.DataWrapper localBundle, java.util.Map<java.lang.String,java.lang.String> metadata)
           
 void addRequiredElementBundle(java.net.URI bundleURI, com.parabon.frontier.schemas.client.ElementBundle manifest, java.util.Map<java.lang.String,java.lang.String> metadata)
           
 void addRequiredElementBundle(java.net.URI bundleURI, java.io.File localBundle, java.util.Map<java.lang.String,java.lang.String> metadata)
           
protected  com.parabon.io.DataWrapper getElement(java.net.URI uri)
           
 com.parabon.client.ElementContainer getElementContainer()
           
 java.util.Set<java.net.URI> getElementURIs()
          Get a read-only Set containing the URIs of elements in this task.
 Job getJob()
           
 com.parabon.io.DataWrapper getParams()
          Get the parameter data for this task.
 java.util.Map<java.lang.String,java.lang.String> getRequiredElementMetadata(java.net.URI uri)
           
 java.util.Set<java.net.URI> getRequiredElementURIs()
          Get a read-only Set containing the URIs of elements currently marked as required for this task.
 java.lang.String getRunnableClass()
          Get the task's primary (entry-point) runnable class name.
 java.util.Map<java.lang.String,java.lang.String> getRuntimeParams()
           
 TaskSpec.SchedulingConstraints getSchedulingConstraints()
          Retrieve the set of scheduling constraints which specify the required characteristics of a compute node on which this task may be scheduled and executed.
 java.lang.String getTaskID()
           
 java.net.URI getVisualizationURI()
           
protected  boolean isBundle(java.net.URI uri)
           
 void removeRequiredElement(java.net.URI uri)
           
 void removeRuntimeParam(java.lang.String key)
           
protected  com.parabon.io.DataWrapper resolveElement(java.net.URI uri)
           
protected  void set(TaskSpec o)
          Set the current TaskSpec to be identical to that provided.
 void setParams(com.parabon.io.DataWrapper params)
          Set task parameters.
 void setParams(java.io.File params)
          Set task parameters.
 void setRequireNativeAccess(boolean requireNativeAccess)
          This task requries native code execution access from the engine runtime.
 void setRequireNetworkAccess(boolean requireNetworkAccess)
          This task requries network access from the engine runtime.
 void setRunnableClass(java.lang.Class<? extends Task> c)
          Specify the task's primary (entry-point) runnable class.
 void setRunnableClass(java.lang.String s)
          Specify the task's primary (entry-point) runnable class.
 void setRuntimeParam(java.lang.String key, java.lang.String value)
           
 void setSchedulingConstraints(TaskSpec.SchedulingConstraints schedulingConstraints)
          Replace the current set of scheduling constraints with those provided.
 void setVisualizationURI(java.net.URI visualizationURI)
          Provide a URI at which a web-based visualization may be found for displaying information about a task on an engine during (or before or after) execution.
protected  void validateTaskID(java.lang.String tid)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskSpec

public TaskSpec(Job job,
                java.lang.String taskID)

TaskSpec

public TaskSpec(Job job,
                java.lang.String taskID,
                TaskSpec other)

TaskSpec

public TaskSpec(TaskSpec other)
Method Detail

getElementContainer

public com.parabon.client.ElementContainer getElementContainer()

validateTaskID

protected void validateTaskID(java.lang.String tid)

set

protected void set(TaskSpec o)
Set the current TaskSpec to be identical to that provided.


getJob

public Job getJob()

getTaskID

public java.lang.String getTaskID()

getRuntimeParams

public java.util.Map<java.lang.String,java.lang.String> getRuntimeParams()

setRuntimeParam

public void setRuntimeParam(java.lang.String key,
                            java.lang.String value)

removeRuntimeParam

public void removeRuntimeParam(java.lang.String key)

setRunnableClass

public void setRunnableClass(java.lang.Class<? extends Task> c)
Specify the task's primary (entry-point) runnable class. This class must exist in one of the executable elements required for the task, and must implement the com.parabon.runtime.Task interface.


setRunnableClass

public void setRunnableClass(java.lang.String s)
Specify the task's primary (entry-point) runnable class. This class must exist in one of the executable elements required for the task, and must implement the com.parabon.runtime.Task interface. This should be the fully-qualified classname as provided by Class.getName().

See Also:
Class

getRunnableClass

public java.lang.String getRunnableClass()
Get the task's primary (entry-point) runnable class name.


setParams

public void setParams(java.io.File params)
               throws java.io.FileNotFoundException,
                      java.io.IOException
Set task parameters.

Parameters:
params - a file containing the task's parameter data. The file provided should not be changed or removed after this method is called until the task has been either completed (when running in local or simulator mode) or fully submitted to the server (when running in remote mode) as determined by the associated TaskProxy.start() method having returned; removing it or changing its contents size during this time will result in undefined behaviour.
Throws:
java.io.FileNotFoundException
java.io.IOException

setParams

public void setParams(com.parabon.io.DataWrapper params)
               throws com.parabon.io.DataWrapper.UnlinkedException
Set task parameters.

Parameters:
params - a DataWrapper containing the task's parameter data. The referenced data sent should not be changed after this method is called; doing so will result in undefined behaviour.
Throws:
com.parabon.io.DataWrapper.UnlinkedException

getParams

public com.parabon.io.DataWrapper getParams()
Get the parameter data for this task.

Note that the returned DataWrapper will remain valid until this TaskSpec has been destroyed or until the parameters have been changed; DataWrapper.link() must be used to guarantee accessability beyond this point.


addElement

public java.net.URI addElement(com.parabon.io.DataWrapper contents)
Create a task-level element which can be referred to only in this task.

Parameters:
contents - the data to be associated with the new element
Returns:
the global unique identifier which may be used to refer to this element within this task. If the returned URI is used in other tasks, behavior is undefined.

addElement

public java.net.URI addElement(java.lang.String identifier,
                               com.parabon.io.DataWrapper contents)
Create a task-level element which can be referred to only in this task.

Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this task; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - the data to be associated with the new element
Returns:
the global unique identifier which may be used to refer to this element by this task. If the returned URI is used in other tasks, behavior is undefined.

addElement

public java.net.URI addElement(java.io.File contents)
                        throws java.io.FileNotFoundException,
                               java.io.IOException
Create a task-level element which can be referred to only in this task.

Parameters:
contents - a file containing the contents to be associated with the new element, which is guaranteed to not be modified or removed during the lifetime of the associated RemoteSessionManager (that is, until destroy() has successfully completed)
Returns:
the global unique identifier which may be used to refer to this element by this task. If the returned URI is used in other tasks, behavior is undefined.
Throws:
java.io.FileNotFoundException
java.io.IOException

addElement

public java.net.URI addElement(java.lang.String identifier,
                               java.io.File contents)
                        throws java.io.FileNotFoundException,
                               java.io.IOException
Create a task-level element which can be referred to only in this task.

Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this task; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - a file containing the contents to be associated with the new element, which is guaranteed to not be modified or removed during the lifetime of the associated RemoteSessionManager (that is, until destroy() has successfully completed)
Returns:
the global unique identifier which may be used to refer to this element by this task. If the returned URI is used in other tasks, behavior is undefined.
Throws:
java.io.FileNotFoundException
java.io.IOException

addElementBundle

public java.net.URI addElementBundle(com.parabon.io.DataWrapper contents)
Create a task-level element bundle containing elements which can be referred to only in this task.

Parameters:
contents - the data to be associated with the new elements. The data must be in Parabon Element Bundle format, including a valid bundle manifest.
Returns:
the global unique identifier which may be used to refer to the elements in the bundle from within this task. If the returned URI is used in other tasks, behavior is undefined.

addElementBundle

public java.net.URI addElementBundle(java.lang.String identifier,
                                     com.parabon.io.DataWrapper contents)
Create a task-level element bundle containing elements which can be referred to only in this task.

Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this task; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - the data to be associated with the new elements. The data must be in Parabon Element Bundle format, including a valid bundle manifest.
Returns:
the global unique identifier which may be used to refer to the elements in the bundle from within this task. If the returned URI is used in other tasks, behavior is undefined.

addElementBundle

public java.net.URI addElementBundle(java.io.File contents)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
Create a task-level element bundle containing elements which can be referred to only in this task.

Parameters:
contents - a file containing the contents to be associated with the new elements, which is guaranteed to not be modified or removed during the lifetime of the associated RemoteSessionManager (that is, until destroy() has successfully completed). The data must be in Parabon Element Bundle format, including a valid bundle manifest.
Returns:
the global unique identifier which may be used to refer to the elements in the bundle from within this task. If the returned URI is used in other tasks, behavior is undefined.
Throws:
java.io.FileNotFoundException
java.io.IOException

addElementBundle

public java.net.URI addElementBundle(java.lang.String identifier,
                                     java.io.File contents)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
Create a task-level element bundle containing elements which can be referred to only in this task.

Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this task; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - a file containing the contents to be associated with the new elements, which is guaranteed to not be modified or removed during the lifetime of the associated RemoteSessionManager (that is, until destroy() has successfully completed). The data must be in Parabon Element Bundle format, including a valid bundle manifest.
Returns:
the global unique identifier which may be used to refer to the elements in the bundle from within this task. If the returned URI is used in other tasks, behavior is undefined.
Throws:
java.io.FileNotFoundException
java.io.IOException

getElement

protected com.parabon.io.DataWrapper getElement(java.net.URI uri)
                                         throws NoSuchElementException
Throws:
NoSuchElementException

resolveElement

protected com.parabon.io.DataWrapper resolveElement(java.net.URI uri)
                                             throws NoSuchElementException
Throws:
NoSuchElementException

isBundle

protected boolean isBundle(java.net.URI uri)
                    throws NoSuchElementException
Throws:
NoSuchElementException

getElementURIs

public java.util.Set<java.net.URI> getElementURIs()
Get a read-only Set containing the URIs of elements in this task.


addRequiredElement

public void addRequiredElement(java.net.URI uri,
                               java.util.Map<java.lang.String,java.lang.String> metadata)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement is still needed.


addRequiredElement

public void addRequiredElement(java.net.URI uri)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement is still needed.


addRequiredElementAsClasspathJar

public void addRequiredElementAsClasspathJar(java.net.URI uri)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement* is still needed.


addRequiredElementBundle

public void addRequiredElementBundle(java.net.URI bundleURI,
                                     java.io.File localBundle,
                                     java.util.Map<java.lang.String,java.lang.String> metadata)
                              throws java.io.IOException
Throws:
java.io.IOException

addRequiredElementBundle

public void addRequiredElementBundle(java.net.URI bundleURI,
                                     com.parabon.io.DataWrapper localBundle,
                                     java.util.Map<java.lang.String,java.lang.String> metadata)
                              throws java.io.IOException
Throws:
java.io.IOException

addRequiredElementBundle

public void addRequiredElementBundle(java.net.URI bundleURI,
                                     com.parabon.frontier.schemas.client.ElementBundle manifest,
                                     java.util.Map<java.lang.String,java.lang.String> metadata)
                              throws java.io.IOException
Throws:
java.io.IOException

addRequiredElementAsClasspathJar

public void addRequiredElementAsClasspathJar(java.net.URI uri,
                                             java.util.Map<java.lang.String,java.lang.String> metadata)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement* is still needed.


addRequiredElementAsNativeLibrary

public void addRequiredElementAsNativeLibrary(java.net.URI uri)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement* is still needed.


addRequiredElementAsNativeLibrary

public void addRequiredElementAsNativeLibrary(java.net.URI uri,
                                              java.util.Map<java.lang.String,java.lang.String> metadata)
Specify that the element referenced by this URI is required in the execution of this particular task. Note that elements added directly to this task (via this TaskSpec) are not implicitly required, so a call to addRequiredElement* is still needed.


removeRequiredElement

public void removeRequiredElement(java.net.URI uri)

getRequiredElementURIs

public java.util.Set<java.net.URI> getRequiredElementURIs()
Get a read-only Set containing the URIs of elements currently marked as required for this task.


getRequiredElementMetadata

public java.util.Map<java.lang.String,java.lang.String> getRequiredElementMetadata(java.net.URI uri)

setSchedulingConstraints

public void setSchedulingConstraints(TaskSpec.SchedulingConstraints schedulingConstraints)
Replace the current set of scheduling constraints with those provided. Note that only the contents of the given SchedulingConstraints instance will be copied; the provided SchedulingConstraints instance may be freely modified after this method returns without affecting the contents of this TaskSpec.


getSchedulingConstraints

public TaskSpec.SchedulingConstraints getSchedulingConstraints()
Retrieve the set of scheduling constraints which specify the required characteristics of a compute node on which this task may be scheduled and executed. The returned SchedulingConstraints may be modified freely (as long as the associated TaskSpec may be legally modified), and these modifications will directly modify the associated TaskSpec.


setVisualizationURI

public void setVisualizationURI(java.net.URI visualizationURI)
Provide a URI at which a web-based visualization may be found for displaying information about a task on an engine during (or before or after) execution.


getVisualizationURI

public java.net.URI getVisualizationURI()

setRequireNetworkAccess

public void setRequireNetworkAccess(boolean requireNetworkAccess)
This task requries network access from the engine runtime. The user requires special privileges to use this method.


setRequireNativeAccess

public void setRequireNativeAccess(boolean requireNativeAccess)
This task requries native code execution access from the engine runtime. The user requires special privileges to use this method.