com.parabon.client
Class RuntimeTaskSpec

java.lang.Object
  extended by com.parabon.client.TaskSpec
      extended by com.parabon.client.GenericTaskSpec
          extended by com.parabon.client.RuntimeTaskSpec
Direct Known Subclasses:
NativeTaskSpec

public class RuntimeTaskSpec
extends GenericTaskSpec

RuntimeTaskSpec allows creation of tasks which use alternative task runtime environments rather than the standard Java task runtime. A client application can select a specific runtime by supplying a regular expression against which runtime identifiers are matched, as well as a runtime-specific command line and environment to control the execution of the task.

See Also:
TaskSpec

Nested Class Summary
 
Nested classes/interfaces inherited from class com.parabon.client.TaskSpec
TaskSpec.ExternalPackage, TaskSpec.NetworkTypeConstraint, TaskSpec.SchedulingConstraints
 
Constructor Summary
RuntimeTaskSpec(Job job, java.lang.String taskID)
           
 
Method Summary
 void exec(java.lang.String... args)
          Deprecated.  
 void exec(java.lang.String[] args, java.lang.String[] env)
          Deprecated.  
 void requireExtension(java.lang.String name)
          Require the task to be scheduled on a compute engine with the supplied extension name.
 void requireExtension(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metaData)
          Require the task to be scheduled on a compute engine with the supplied extension name.
 void requireExtension(java.net.URI uri)
          Require the task to be scheduled on a compute engine with the supplied extension name.
 void requireExtension(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> metaData)
          Require the task to be scheduled on a compute engine with the supplied extension name.
 void setCommandLine(java.lang.String... args)
          Execute the supplied command line on the remote runtime.
 void setCommandLine(java.lang.String[] args, java.lang.String[] env)
          Execute the supplied command line on the remote runtime with the supplied environment variables set.
 void setExecutable(java.net.URI uri)
          Sets the required element as an executable file.
 void setIntermediateResultFrequency(int interval)
          Set the intermediate result frequency (in seconds).
 void setOutputFile(java.lang.String... file)
          List of output files the task will generate.
 void setProgressReportFrequency(int interval)
          Set the progress report interval.
 void setRequireNetworkAccess(boolean value)
          This task requries network access from the engine runtime.
 void setRequireNetworkAccess(java.lang.String type)
          Set required network access for the task.
 void setSchedulingConstraints(TaskSpec.SchedulingConstraints schedulingConstraints)
          Postprocess the scheduling constraints to provide the runtime with additional limits.
 void setTargetFilename(java.net.URI uri, java.lang.String fileName)
          Override the required element target file name.
 
Methods inherited from class com.parabon.client.GenericTaskSpec
setRuntime, setRuntimeParam
 
Methods inherited from class com.parabon.client.TaskSpec
addElement, addElement, addElement, addElement, addElementBundle, addElementBundle, addElementBundle, addElementBundle, addRequiredElement, addRequiredElement, addRequiredElementAsClasspathJar, addRequiredElementAsClasspathJar, addRequiredElementAsNativeLibrary, addRequiredElementAsNativeLibrary, addRequiredElementBundle, addRequiredElementBundle, addRequiredElementBundle, getElement, getElementContainer, getElementURIs, getJob, getParams, getRequiredElementMetadata, getRequiredElementURIs, getRunnableClass, getRuntimeParams, getSchedulingConstraints, getTaskID, getVisualizationURI, isBundle, removeRequiredElement, removeRuntimeParam, resolveElement, set, setParams, setParams, setRequireNativeAccess, setRunnableClass, setRunnableClass, setVisualizationURI, validateTaskID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeTaskSpec

public RuntimeTaskSpec(Job job,
                       java.lang.String taskID)
Method Detail

setIntermediateResultFrequency

public void setIntermediateResultFrequency(int interval)
Set the intermediate result frequency (in seconds). If set, the compute engine will take a snapshot of the output files and return to the client application at the specified frequency. Note however, files may be in an inconsistent state since the snapshot will likely occur while the task is still running and potentially writing to its output files. For a safer snapshot, the task's main program can periodically call the "runtime-request interim-result" command via the shell or equivalent system() call to request a data snapshot. This process will block until the snapshot is complete to ensure consistent data. If the task elects to use this mechanism, setting the intermediate result frequency is not necessary since it will be the task's responsibility manage the frequency. Arguments may also be supplied to the "runtime-request" command line to set the task's progress. Usage statement for "runtime-request" is: runtime-request interim-result [progress:float]
e.g. runtime-request interim-result 0.10
- will post an intermediate result with a progress of 10%

Parameters:
interval - Task status interval.
Note: the compute engine honors a system wide maximum interval which may override the supplied value.

setProgressReportFrequency

public void setProgressReportFrequency(int interval)
Set the progress report interval. If set, the compute engine will send a task progress event to the client application at the specified interval. Alternatively, the task's main program can periodically call the "runtime-request progress" command via the shell or equivalent system() call to request an immediate progress report.

Usage statement for "runtime-request progress" is: runtime-request progress floatValue
e.g. runtime-request progress 0.10
- will post a progress report with a progress value of 10%

Parameters:
interval - Task output file checkpoint interval.
Note: the compute engine honors a system wide maximum interval which may override the supplied value.

setOutputFile

public void setOutputFile(java.lang.String... file)
List of output files the task will generate. The output file stream can be retrieved from a RuntimeResult object during receipt of a TaskResultEvent.

Parameters:
file - List of output file paths.

setExecutable

public void setExecutable(java.net.URI uri)
Sets the required element as an executable file. Executable files will be stored to the runtime environment with the "executable" bit set.

Parameters:
uri - Required element URI.

setTargetFilename

public void setTargetFilename(java.net.URI uri,
                              java.lang.String fileName)
Override the required element target file name. When the required element is stored to the runtime environment, it will be stored as the specified file name including leading path information. e.g. /foo/bar/myfile

Parameters:
uri - Required element URI.
fileName - Target file name.

requireExtension

public void requireExtension(java.lang.String name)
Require the task to be scheduled on a compute engine with the supplied extension name. Extensions are pre-deployed on the engine runtime during the provisioning phase.

Parameters:
name - Extension name.

requireExtension

public void requireExtension(java.lang.String name,
                             java.util.Map<java.lang.String,java.lang.String> metaData)
Require the task to be scheduled on a compute engine with the supplied extension name. Extensions are pre-deployed on the engine runtime during the provisioning phase.

Parameters:
name - Extension name.
metaData - Extension meta data.

requireExtension

public void requireExtension(java.net.URI uri)
Require the task to be scheduled on a compute engine with the supplied extension name. Extensions are pre-deployed on the engine runtime during the provisioning phase.

Parameters:
uri - Extension URI.

requireExtension

public void requireExtension(java.net.URI uri,
                             java.util.Map<java.lang.String,java.lang.String> metaData)
Require the task to be scheduled on a compute engine with the supplied extension name. Extensions are pre-deployed on the engine runtime during the provisioning phase.

Parameters:
uri - Extension URI.
metaData - Extension meta data.

setRequireNetworkAccess

public void setRequireNetworkAccess(boolean value)
Description copied from class: TaskSpec
This task requries network access from the engine runtime. The user requires special privileges to use this method.

Overrides:
setRequireNetworkAccess in class TaskSpec

setRequireNetworkAccess

public void setRequireNetworkAccess(java.lang.String type)
Set required network access for the task. Current runtimes support none (default), nat, bridged, or host network access. If type is set to "true", Bridged mode lets the virtual machine share the host's Ethernet connection, while appearing as a separate machine with its own MAC and TCP/IP address. NAT mode translates the network through the hosts NIC, much like the 192.168.1.x machines nat through your router to the internet. Host mode only allows the virtual machine to talk to the hosting machine. In all cases, the underlying runtime assigns DHCP addresses to the virtual network cards.

Parameters:
type - One of "nat", "bridged", "host"
See Also:
RuntimeConstants

setSchedulingConstraints

public void setSchedulingConstraints(TaskSpec.SchedulingConstraints schedulingConstraints)
Postprocess the scheduling constraints to provide the runtime with additional limits.

Overrides:
setSchedulingConstraints in class TaskSpec
Parameters:
schedulingConstraints -

exec

public void exec(java.lang.String... args)
          throws com.parabon.taskutil.InvalidValueException
Deprecated. 

Deprecated. Use commandLine().

Parameters:
args -
Throws:
com.parabon.taskutil.InvalidValueException

exec

public void exec(java.lang.String[] args,
                 java.lang.String[] env)
          throws com.parabon.taskutil.InvalidValueException
Deprecated. 

Deprecated. Use commandLine().

Parameters:
args -
Throws:
com.parabon.taskutil.InvalidValueException

setCommandLine

public void setCommandLine(java.lang.String... args)
                    throws com.parabon.taskutil.InvalidValueException
Execute the supplied command line on the remote runtime. The command line arguments can include any executable or data element referenced by the Job or Task.

Parameters:
args - Command line arguments.
Throws:
com.parabon.taskutil.InvalidValueException
See Also:
TaskSpec.addRequiredElement(java.net.URI, java.util.Map)

setCommandLine

public void setCommandLine(java.lang.String[] args,
                           java.lang.String[] env)
                    throws com.parabon.taskutil.InvalidValueException
Execute the supplied command line on the remote runtime with the supplied environment variables set. Environment variables must follow the "name=value" convention. Command line arguments may include any executable or data element referenced by the Job or Task.

Parameters:
args - Command line arguments.
env - Environment variables.
Throws:
com.parabon.taskutil.InvalidValueException
See Also:
TaskSpec.addRequiredElement(java.net.URI, java.util.Map)