startup.cluster
Class ClusterClassificationAction

java.lang.Object
  extended by startup.cluster.ClusterClassificationAction
All Implemented Interfaces:
java.lang.Runnable

public class ClusterClassificationAction
extends java.lang.Object
implements java.lang.Runnable

This class is a special wrapup around a normal classificationaction. It is designed to execute a normal classificationAction on a GridEngine cluster node, while the parent FunSiPWorkflow object is residing on the master node. The upside of this implementation is the fact that this way the cluster can be utilized, without having to resort to techniques such as java RMI. The downside however is the fact that we have to read and write console-commands to standard output in order to check whether or not the classificationActions running on the cluster nodes have finished or not. This class should in this stage only be used for speeding up the optimalization procedure, which is necessary before building a classification model or using said classification model to evaluate sequence files.

Author:
Michiel Van Bel

Field Summary
static long SLEEP_TIME
          The time a node waits between anouncing its finish (milliseconds).
 
Constructor Summary
ClusterClassificationAction(ClassificationAction ca, FunSiPWorkflow workflow, java.lang.String index, org.apache.log4j.Logger logger)
          Constructor.
 
Method Summary
 int getNumLines(java.io.File f)
          This method simply tries to return the number of lines in a file.
 int getSubmitNumber(java.io.File outputFile, java.io.File errorFile)
          This method parses the submit-number from the outputfile.
 void run()
          Implementation of the run()-method of the Runnable interface.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLEEP_TIME

public static final long SLEEP_TIME
The time a node waits between anouncing its finish (milliseconds).

See Also:
Constant Field Values
Constructor Detail

ClusterClassificationAction

public ClusterClassificationAction(ClassificationAction ca,
                                   FunSiPWorkflow workflow,
                                   java.lang.String index,
                                   org.apache.log4j.Logger logger)
Constructor. Initialization of necessary class variables. Nonne of the passed arguments should be null.

Parameters:
ca - The classification action which needs to be executed on a cluster node.
workflow - The parent workflow.
index - The index of the classification action in the parent workflow.
logger - The logging facility.
Method Detail

run

public void run()
Implementation of the run()-method of the Runnable interface. Necessary to start this action as a seperate thread. This method will trie to create a job on the cluster, after which it will wait until the job is finished. Then, it will notify the parent workflow.

Specified by:
run in interface java.lang.Runnable

getNumLines

public int getNumLines(java.io.File f)
This method simply tries to return the number of lines in a file. Various error checks are performed, in order not to return impossible values.

Parameters:
f - The file f, from which the number of lines should be extracted.
Returns:
The number of lines in the file.

getSubmitNumber

public int getSubmitNumber(java.io.File outputFile,
                           java.io.File errorFile)
This method parses the submit-number from the outputfile. Some serious error checking is going on inside. Normally the returned number is the number given by the cluster software to this job. However, the values -1, -2, -3 are also possible: a)-1 : General exception, impossible to obtain job number. b)-2 : The error file is not empty c)-3 : If an error occured while reading the output en error files.

Parameters:
outputFile - The file containing standard output from the qsub-command
errorFile - The file containing error output from the qsub-command
Returns:
The number assigned to this job by the cluster software.