org.promethee.api
Class RunShell

java.lang.Object
  extended by org.promethee.api.Shell
      extended by org.promethee.api.RunShell
All Implemented Interfaces:
org.promethee.ui.parameter.Case.Observer

public class RunShell
extends Shell
implements org.promethee.ui.parameter.Case.Observer

Open API to launch Promethee grid computations using parametrized input files and wrapped code/model.
Once object instanciated, the run() call will launch all calculations and return a Map of results.

Author:
Y. Richet

Nested Class Summary
 
Nested classes/interfaces inherited from class org.promethee.api.Shell
Shell.TrapSignalHandler
 
Field Summary
static java.lang.String[] MODELS
           
 
Constructor Summary
RunShell(java.lang.String _model, java.io.File... _input)
          Constructor of grid computing project.
 
Method Summary
 void addCacheDirectory(java.io.File dir)
          Add a given directory to cache for the project.
 void caseModified(int index, int what)
          Called each time the case is modified.
 java.io.File defaultArchiveDirectory()
           
 java.lang.String[] getInputVariables()
          Provide information about available input.
 java.lang.String[] getOutputAvailable()
          Provide information about available output.
 int getRetries()
           
static java.lang.String gridStatusInformation()
           
 java.lang.String inputExperimentsInformation()
          Convenience method to see experiments to run.
 java.lang.String outputInformation()
          Provide information about available output.
 java.lang.String projectInformation()
          Provide information about the whole project.
 void redirectOutErr()
          to redirect in and err stream in .out and .err
 java.util.Map<java.lang.String,java.lang.String[]> run()
          Method to start computing of all experiments
 void setInputExperiments(java.util.Map var_values)
          Define input sample.
 void setInputExperiments(java.util.Map var_values, boolean group)
          Define input sample.
 void setOutputExpressions(java.lang.String... custom_outs)
          Define output
 void setRetries(int retries)
           
 void shutdown()
           
 java.lang.String variablesInformation()
          Provide information about available input.
 
Methods inherited from class org.promethee.api.Shell
ArrayMapToString, ArrayMapToString, delete, getArchiveDirectory, keys, MapToString, MapToString, setArchiveDirectory, setArchiveDirectory, setConsoleVisible, setMathConsoleVisible, setVerboseLevel, toObject, toString, trap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODELS

public static java.lang.String[] MODELS
Constructor Detail

RunShell

public RunShell(java.lang.String _model,
                java.io.File... _input)
         throws java.lang.Exception
Constructor of grid computing project.

Parameters:
_model - Name of the model/code to use for computing.
_input - List of input files to give as argument to the code/model. These (ASCII) files should contain variables (like $toto).
Throws:
java.lang.Exception
Method Detail

addCacheDirectory

public void addCacheDirectory(java.io.File dir)
Add a given directory to cache for the project. Before any calculation to be launched, Promethee will chekc that it is not already in the cache. In this case, the calculation is not re-launched, and cache results are used.

Parameters:
dir - Directory to add in cache

getInputVariables

public java.lang.String[] getInputVariables()
Provide information about available input.

Returns:
List of variables available in the input files with given code/model.

variablesInformation

public java.lang.String variablesInformation()
Provide information about available input.

Returns:
a String of variables available (and related info) in the input files with given code/model.

inputExperimentsInformation

public java.lang.String inputExperimentsInformation()
Convenience method to see experiments to run.

Returns:
A table / string representation of all experiments.

projectInformation

public java.lang.String projectInformation()
Provide information about the whole project.

Returns:
general information about a project.

gridStatusInformation

public static java.lang.String gridStatusInformation()

setInputExperiments

public void setInputExperiments(java.util.Map var_values)
                         throws java.lang.Exception
Define input sample.

Parameters:
var_values - Combinations of variables (as String keys) and their values (as String[]) to compute.
Throws:
java.lang.Exception
See Also:
setInputExperiments(HashMap var_values, boolean group)

setInputExperiments

public void setInputExperiments(java.util.Map var_values,
                                boolean group)
                         throws java.lang.Exception
Define input sample.

Parameters:
var_values - Combinations of variables (as String keys) and their values (as String[]) to compute.
group - True means that all multiple var_values values are synchronized with others. False means that number of experiments is the product of all values sizes.
Throws:
java.lang.Exception

setOutputExpressions

public void setOutputExpressions(java.lang.String... custom_outs)
Define output

Parameters:
custom_outs - Math. expressions of output of interest to compute. Possibly including input variables.

getOutputAvailable

public java.lang.String[] getOutputAvailable()
Provide information about available output.

Returns:
List of available output from input files and given code/model.

outputInformation

public java.lang.String outputInformation()
Provide information about available output.

Returns:
List of available output from input files and given code/model.

defaultArchiveDirectory

public java.io.File defaultArchiveDirectory()
Specified by:
defaultArchiveDirectory in class Shell

getRetries

public int getRetries()
Returns:
the retries number for a failed calculation

setRetries

public void setRetries(int retries)
Parameters:
retries - the number of retries for a failed claculation

caseModified

public void caseModified(int index,
                         int what)
Description copied from interface: org.promethee.ui.parameter.Case.Observer
Called each time the case is modified.

Specified by:
caseModified in interface org.promethee.ui.parameter.Case.Observer
Parameters:
index - modified case
what - modification type

run

public java.util.Map<java.lang.String,java.lang.String[]> run()
Method to start computing of all experiments

Returns:
HashMap of array of input, output, information for all experiments.

shutdown

public void shutdown()
Overrides:
shutdown in class Shell

redirectOutErr

public void redirectOutErr()
to redirect in and err stream in .out and .err

Specified by:
redirectOutErr in class Shell