org.knime.core.node.workflow
Class NodeExecutionJob

java.lang.Object
  extended by org.knime.core.node.workflow.NodeExecutionJob
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
LocalNodeExecutionJob

public abstract class NodeExecutionJob
extends Object
implements Runnable

Runnable that represents the execution of a node. This abstract class defines the overall procedure of an execution including setup (e.g. to copy the necessary data onto a cluster master), main execution and result retrieval. It also reflects the current step of the execution in the node's state.

Author:
Bernd Wiswedel, University of Konstanz, Peter Ohl, University of Konstanz

Constructor Summary
protected NodeExecutionJob(NodeContainer nc, PortObject[] data)
          Creates a new execution job for a given node.
 
Method Summary
protected  void afterExecute()
          Called to finalize the execution.
protected  void beforeExecute()
          Called right after the node has switched to the NodeContainer.State.PREEXECUTE state.
protected abstract  boolean cancel()
          Called when the execution is to be canceled.
protected  NodeContainer getNodeContainer()
          Access method for the accompanying node container.
protected  PortObject[] getPortObjects()
          Access method for the input port objects.
protected abstract  boolean isReConnecting()
          Whether this job has been disconnected (from a cluster execution, e.g.) and is now resuming the execution.
(package private)  boolean isSavedForDisconnect()
           
protected abstract  NodeContainerExecutionStatus mainExecute()
          Called when the main execution takes place.
 void run()
          
(package private)  void setSavedForDisconnect(boolean isSavedForDisconnect)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeExecutionJob

protected NodeExecutionJob(NodeContainer nc,
                           PortObject[] data)
Creates a new execution job for a given node. The array argument represent the available input data..

Parameters:
nc - The node that is to be executed.
data - The input data of that node, must not be null, nor contain null elements.
Method Detail

run

public final void run()

Specified by:
run in interface Runnable

isReConnecting

protected abstract boolean isReConnecting()
Whether this job has been disconnected (from a cluster execution, e.g.) and is now resuming the execution. If so, the execution procedure will skip the execution setup. This property will be false for locally executed nodes.

Returns:
The above described property.

beforeExecute

protected void beforeExecute()
Called right after the node has switched to the NodeContainer.State.PREEXECUTE state. Remote job executors will setup the execution environment in this step and therefore overwrite this (empty) method.


mainExecute

protected abstract NodeContainerExecutionStatus mainExecute()
Called when the main execution takes place. The node will be in the appropriate state (NodeContainer.State.EXECUTING or NodeContainer.State.EXECUTINGREMOTELY when this method is called.

Returns:
Whether the execution was successful.

afterExecute

protected void afterExecute()
Called to finalize the execution. For instance, remote executors will copy the result data onto the local machine. This method is called no matter if the main execution was successful or not.


cancel

protected abstract boolean cancel()
Called when the execution is to be canceled.

Returns:
Whether the cancelation was successful.
See Also:
Future.cancel(boolean)

getPortObjects

protected final PortObject[] getPortObjects()
Access method for the input port objects.

Returns:
Input port objects as passed into constructor.

getNodeContainer

protected final NodeContainer getNodeContainer()
Access method for the accompanying node container.

Returns:
NodeContainer as passed into constructor.

setSavedForDisconnect

void setSavedForDisconnect(boolean isSavedForDisconnect)
Parameters:
isSavedForDisconnect - the isSavedForDisconnect to set

isSavedForDisconnect

boolean isSavedForDisconnect()
Returns:
the isSavedForDisconnect


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.