public class JobLauncher extends Item
The JobLauncher class handles local and remote job launch of simulations and other tasks. It implements process(), reviewEntries() and setupForm(). Subclasses must override setupForm(), call super.setupForm() to properly construct the Form and JobLauncher Item and call setExecutable() with the executable name, description and command name. It uses a LocalExecutorAction or a RemoteExecutorAction, depending on whether or not the job should be launched locally or remotely. If the job is launched remotely, the JobLauncher may need to request additional information for a username and password, (possibly even a keyboard-interactive password).
The platforms on which the job can be launched must be configured with the addHost() operation.
It is possible to direct the JobLauncher to enable support for parallelism via TBB, OpenMP and MPI. This will only work so long as MPI is installed on the remote system and available on the user's PATH and if the executable is compiled with MPI, TBB and/or OpenMP support. It is possible to enable MPI, TBB and/or OpenMP support at the same time.
The JobLauncher gets its input information from the DataComponent on the JobLauncherForm and it places ICEResources that represent its output on the ResourceComponent on the JobLauncherForm.
The setExecutable() operation uses string replacement to replace a select number of flags in the executable string. See that operation for details. The flags are:
${installDir} - The installation directory of the executable on the current host.
${inputFile} - The input file for the job.
These flags can be inserted as part of the executable name and the JobLauncher will automatically replace them for the appropriate host so long as they are provided. By defeault the JobLauncher appends the name of the input file to the end of the executable string. This option can be disabled by calling setAppendInputFlag.
The setExecutable() operation should not be called with MPI, OpenMP or Intel TBB directives as part of the executable. If it is, the JobLauncher will not attempt consider the launch command as hard-wired and it will not try to change the number of cores or threads. It will still perform any string replacement that may be required for any included flags.
JobLaunchers expect that there will always be at least one input file and always configures itself to require at least one file. Some situations may require multiple types of input files. For example, a particular simulator may require run time parameters, a 3d mesh and materials information in one file and another simulator may expect three separate files for this information. The two additional input file types can be added to the job launcher by calling the addInputType() operation.
component
Constructor and Description |
---|
JobLauncher()
The constructor.
|
JobLauncher(org.eclipse.core.resources.IProject projectSpace)
The constructor with a project space in which files should be
manipulated.
|
Modifier and Type | Method and Description |
---|---|
void |
addHost(java.lang.String hostname,
java.lang.String os,
java.lang.String execInstallPath)
This operation adds a host to the set of available hosts on which the
JobLauncher can launch the job.
|
void |
addInputType(java.lang.String name,
java.lang.String varName,
java.lang.String description,
java.lang.String fileExtension)
This operation adds a new input file type to the JobLauncher.
|
java.lang.Object |
clone()
This operation provides a deep copy of the JobLauncher.
|
void |
copy(JobLauncher otherLauncher) |
void |
deleteHost(java.lang.String hostname)
This operation removes a host from the set of hosts on which the
JobLauncher can launch a job.
|
void |
disableMPI()
This operation disables MPI support for the job.
|
void |
disableOpenMP()
This operation disables OpenMP support for the job.
|
void |
disableTBB()
This operation disables Intel Thread Building Block (TBB) support for the
job.
|
void |
enableMPI(int minProcesses,
int maxProcesses,
int defaultProcesses)
This operation directs the JobLauncher to enable MPI support for this
task.
|
void |
enableOpenMP(int minThreads,
int maxThreads,
int defaultThreads)
This operation enables OpenMP support for the job so long as the
executable was compiled with OpenMP support.
|
void |
enableTBB(int minThreads,
int maxThreads,
int defaultThreads)
This operation enables Intel Thread Building Block (TBB) support for the
job so long as the executable was compiled with Intel Thread Building
Block (TBB) support.
|
boolean |
equals(JobLauncher otherLauncher)
This operation is used to check equality between the JobLauncher and
another JobLauncher.
|
java.util.ArrayList<java.lang.String> |
getAllHosts()
This operation returns the hostnames of all the hosts available to this
JobLauncher.
|
int |
hashCode()
This operation returns the hashcode value of the JobLauncher.
|
FormStatus |
process(java.lang.String actionName)
This operation performs the job launch if the action name is equal to
"Launch the Job"
|
void |
reloadProjectData()
This operation directs the JobLauncher to reload the data it used from
the project space.
|
void |
removeInputType(java.lang.String name)
This method removes an input file type from the Job Launcher.
|
void |
setExecutable(java.lang.String execName,
java.lang.String execDesc,
java.lang.String execCommand)
This operation is used to set the executable name, description and
command name for the job that should be launched.
|
void |
update(IUpdateable component)
This method provides a implementation of the IUpdateable interface that
listens for changes in the JobLauncher Input File and updates its file
DataComponent based on other referenced files in the input file.
|
addListener, cancelProcess, cancelProcess, copy, disable, equals, getAvailableActions, getDescription, getForm, getId, getItemBuilderName, getItemType, getName, getOutputFile, getResource, getResource, getStatus, hasProject, isEnabled, loadFromPSF, loadInput, setActionFactory, setDescription, setId, setIOService, setItemBuilderName, setName, setProject, setupFormWithServices, submitForm, update, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
public JobLauncher(org.eclipse.core.resources.IProject projectSpace)
The constructor with a project space in which files should be manipulated.
projectSpace
- The Eclipse project where files should be stored and from which they should be retrieved.
public JobLauncher()
The constructor.
public void setExecutable(java.lang.String execName, java.lang.String execDesc, java.lang.String execCommand)
This operation is used to set the executable name, description and command name for the job that should be launched. It may contain one of two flags that will be replaced by string replacement before launch: ${inputFile} and ${installDir}. The ${inputFile} flag will be replaced with the name of the input file that should be used during the launch and the ${installDir} flag will be replaced with the installation directory of the executable for the given host as configured with the addHost() operation. If the ${inputFile} flag is used, the JobLauncher will set inputFile=none in the dictionary used by the RemoteExecutorAction.
Set executable should only be called once.
execName
- The proper and full name of the job that will be launched (e.g. - Microsoft Word). The JobLauncher class appends " Launcher" to this name.
execDesc
- The description of the executable.
execCommand
- The name of the executable command that should be launched. This is different than the proper name of the executable. For example, the name of a popular Linux text editor is Vi Improved, but its executable command name is vim.
public FormStatus process(java.lang.String actionName)
This operation performs the job launch if the action name is equal to "Launch the Job"
public void addHost(java.lang.String hostname, java.lang.String os, java.lang.String execInstallPath)
This operation adds a host to the set of available hosts on which the JobLauncher can launch the job. If a host is a duplicate, it is not added. If the hostname is the same, but the other attributes are different, this operation will overwrite an existing host.
hostname
- The hostname of the new host.
os
- The operating system of the new host.
execInstallPath
- The installation path of the executable on the host.
public void deleteHost(java.lang.String hostname)
This operation removes a host from the set of hosts on which the JobLauncher can launch a job. If the host is not in the set, it does nothing.
hostname
- The hostname to remove from the set of hosts.
public java.util.ArrayList<java.lang.String> getAllHosts()
This operation returns the hostnames of all the hosts available to this JobLauncher.
The list of hostnames or null if there are not hosts configured.
public void enableMPI(int minProcesses, int maxProcesses, int defaultProcesses)
This operation directs the JobLauncher to enable MPI support for this task. It expects "mpirun" to be in the users' PATH on the remote machine. A value of zero or less than zero passed to this operation will be ignore and set to 1. Furthermore, the maximum must be greater than the minimum and the default value must be equal to or in between the maximum and minimum. If these conditions are not met, it will not be enabled.
minProcesses
- The minimum number of processes that should be allowed for this job.
maxProcesses
- The maximum number of processes that should be allowed for this job.
defaultProcesses
- The default number of processes for MPI to use.
public void disableMPI()
This operation disables MPI support for the job.
public void enableOpenMP(int minThreads, int maxThreads, int defaultThreads)
This operation enables OpenMP support for the job so long as the executable was compiled with OpenMP support. A value of zero or less than zero passed to this operation will be ignore and set to 1. Furthermore, the maximum must be greater than the minimum and the default value must be equal to or in between the maximum and minimum. If these conditions are not met, it will not be enabled.
minThreads
- The minimum number of threads that should be allowed for this job.
maxThreads
- The maximum number of threads that should be allowed for this job.
defaultThreads
- The default number of threads that should be allowed for this job.
public void disableOpenMP()
This operation disables OpenMP support for the job.
public void enableTBB(int minThreads, int maxThreads, int defaultThreads)
This operation enables Intel Thread Building Block (TBB) support for the job so long as the executable was compiled with Intel Thread Building Block (TBB) support. A value of zero or less than zero passed to this operation will be ignore and set to 1. Furthermore, the maximum must be greater than the minimum and the default value must be equal to or in between the maximum and minimum. If these conditions are not met, it will not be enabled.
minThreads
- The minimum number of threads that should be allowed for this job.
maxThreads
- The maximum number of threads that should be allowed for this job.
defaultThreads
- The default number of threads that should be allowed for this job.
public void disableTBB()
This operation disables Intel Thread Building Block (TBB) support for the job.
public boolean equals(JobLauncher otherLauncher)
This operation is used to check equality between the JobLauncher and another JobLauncher. It returns true if the Items are equal and false if they are not.
otherLauncher
- The JobLauncher that should be checked for equality.
True if the launchers are equal, false if not
public int hashCode()
This operation returns the hashcode value of the JobLauncher.
hashCode
in interface Identifiable
hashCode
in class Item
The hashcode
public void copy(JobLauncher otherLauncher)
otherLauncher
- This operation performs a deep copy of the attributes of another JobLauncher into the current JobLauncher.
public java.lang.Object clone()
This operation provides a deep copy of the JobLauncher.
clone
in interface Identifiable
clone
in class Item
A clone of the JobLauncher.
public void addInputType(java.lang.String name, java.lang.String varName, java.lang.String description, java.lang.String fileExtension)
This operation adds a new input file type to the JobLauncher.
name
- The name of the input file type. ("Input" or "Host configuration" or "Materials information" for example)
varName
- The name that will be used to refer to this input file when it is referred to by a variable in, for example, the executable string that is used by the JobLauncher. This name must end with the word "file" and, by convention, it should not contain white space or special symbols. If it does not end with the word "file," the JobLauncher will attempt to add it.
This parameter may not be null.
description
- A short description of the input file.
fileExtension
- The file type extension that should be used to filter files from the project space for this input. If this parameter is null, then it will ignored.
public void removeInputType(java.lang.String name)
name
- The name of the input file type to remove.public void reloadProjectData()
This operation directs the JobLauncher to reload the data it used from the project space. It reloads the lists of input files used by the launcher.
reloadProjectData
in class Item
public void update(IUpdateable component)
update
in interface IUpdateableListener
update
in class Item
component
- The component that was updated in some way.