Class FWSimConsole
java.lang.Object
net.simplace.sim.FWSimConsole
Command line interface of SIMPLACE. The first argument is the command, the following arguments are options of the
form
-name=value (see echoUsage()):
run: runs a solution with an optional projectcheck: likerunwith check level ONLYpostprocess: prepares the session and runs only its post-processingmigrate: migrates solution and project files (or the whole work directory) withFWSimMigratorrest: starts the REST wrapper server (net.simplace.sim.wrapper.rest)web: starts the web client, a browser page to run solutions and look at their outputs (net.simplace.sim.wrapper.web; optionconfig: properties file with the login)split: splits a project data file into chunks and writes a batch script for a cluster queue
rest and web, the JVM is terminated with System.exit(int) at the end.- Author:
- Andreas Enders
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPrints the usage of all commands and options toSystem.out.static voidEntry point: prints the usage for no arguments,helpor?, otherwise executes the command.static intparseSlotCount(String aValue) Parses the value of the optionslotcount: the number of simulations of a project that run in parallel (default: number of processors minus one, at least 2, seeFWSimEngine.getSlotCount()).protected voidperformMainActions(String aCommand, HashMap<String, String> aOptions) Executes a command with its options, see the class description.readOptions(String[] aArgumentsArray) Parses the options (all arguments after the command).static StringremoveEnclosingQuotes(String aValue) Removes quotes that enclose the whole value of an option ("value"or'value'), e.g.
-
Constructor Details
-
FWSimConsole
public FWSimConsole()
-
-
Method Details
-
main
Entry point: prints the usage for no arguments,helpor?, otherwise executes the command.- Parameters:
aArgumentsArray- command followed by the options
-
readOptions
Parses the options (all arguments after the command). Each option has the form-name=value; a short name (one letter,fd,fp) is expanded (seereplaceShortForm(String)),-v:name=valuebecomesvariable:name. Quotes enclosing the whole value are removed (seeremoveEnclosingQuotes(String)). Arguments not starting with-, without=or with an unknown short name are skipped with a warning.- Parameters:
aArgumentsArray- all command line arguments, including the command at index 0- Returns:
- the options by name
-
removeEnclosingQuotes
Removes quotes that enclose the whole value of an option ("value"or'value'), e.g. if a calling script passes them literally. Quotes inside the value are kept, so JSON like[{"DOY":1,"yield":500.0}]stays intact. Before (#610) the text between the first and the last double quote was taken, which destroyed every JSON value with double quotes.- Parameters:
aValue- the value of the option- Returns:
- the value without enclosing quotes, trimmed
-
parseSlotCount
Parses the value of the optionslotcount: the number of simulations of a project that run in parallel (default: number of processors minus one, at least 2, seeFWSimEngine.getSlotCount()). Before this option the console could not set it: the parameterslotcountis only read on the GUI path (FWSimEngine.call(int, String, HashMap, APPLICATION_MODE)), and-v:slotcountonly creates a simulation variable.- Parameters:
aValue- value of the option- Returns:
- the slot count (at least 1)
- Throws:
IllegalArgumentException- if the value is not an integer of at least 1
-
performMainActions
Executes a command with its options, see the class description. Forrun,checkandpostprocess:slotcountsets the number of simulations of a project that run in parallel (also forrestandweb)- the directories are set from
target(predefined settings for CLUSTER, BONNACLUSTER, MODULES, RUN) and then fromworkdir,projectsdir,datadir,outputdir - solution and project are searched as given, relative to the work directory, and on the class path
- options
variable:nameoverride solution variables - with
packandlinesthe output directory is packed into an archive (.zip,.taror.tar.gz) and deleted afterwards
- Parameters:
aCommand- the commandaOptions- the options, seereadOptions(String[])
-
echoUsage
protected void echoUsage()Prints the usage of all commands and options toSystem.out.
-