Package repast.simphony.batch.ssh
Class RemoteSession
- java.lang.Object
-
- repast.simphony.batch.ssh.RemoteSession
-
-
Constructor Summary
Constructors Constructor Description RemoteSession()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyCompletionStatus(String outDirectory)
Copies the completion status from the host and directory where the model was run to the specified directory.Callable<Void>
createDonePoller(long frequency)
Create a callable that returns with the model run by this Session is finished.List<MatchedFiles>
findOutput(List<OutputPattern> patterns)
Finds the model output of that is the result of running this Session and returns that those files.String
getHost()
Gets the name or ip address of the remote host.String
getId()
Gets the id (user@host) of this Remote.String
getInput()
Gets the file that contains parameter input for this Session.int
getInstances()
Gets the number of model instances to run on this Remote.String
getKeyFile()
RunningStatus
getStatus(int instance)
Gets the status of the specified instance.String
getUser()
Gets the user account used to log into the remote host.void
initModelArchive(Configuration config, String directory)
Initializes the model for running.void
retrieveRunCompletionStatus()
Retrieves the run completion status (e.g.void
runModel()
Runs the model for this Session.void
setInput(String input)
Sets the file that contains the parameter input for this Session.void
setRunStatus(int instance, RunningStatus status)
Sets the run status for the specified instance on this Remote.
-
-
-
Method Detail
-
getInstances
public int getInstances()
Description copied from interface:Session
Gets the number of model instances to run on this Remote.- Specified by:
getInstances
in interfaceSession
- Returns:
- the number of model instances to run on this Remote.
-
getId
public String getId()
Description copied from interface:Session
Gets the id (user@host) of this Remote.
-
getHost
public String getHost()
Description copied from interface:Session
Gets the name or ip address of the remote host.
-
getUser
public String getUser()
Description copied from interface:Session
Gets the user account used to log into the remote host.
-
getInput
public String getInput()
Description copied from interface:Session
Gets the file that contains parameter input for this Session.
-
getKeyFile
public String getKeyFile()
-
setInput
public void setInput(String input)
Description copied from interface:Session
Sets the file that contains the parameter input for this Session.
-
setRunStatus
public void setRunStatus(int instance, RunningStatus status)
Description copied from interface:Session
Sets the run status for the specified instance on this Remote.- Specified by:
setRunStatus
in interfaceSession
- Parameters:
instance
- the instance idstatus
- the status
-
getStatus
public RunningStatus getStatus(int instance)
Description copied from interface:Session
Gets the status of the specified instance.
-
initModelArchive
public void initModelArchive(Configuration config, String directory) throws ModelArchiveConfiguratorException, SessionException
Initializes the model for running. This configures the model archive for this Session and copies it over to the remote host.- Specified by:
initModelArchive
in interfaceSession
directory
- the directory to copy the model archive into- Throws:
ModelArchiveConfiguratorException
SessionException
-
runModel
public void runModel() throws SessionException
Runs the model for this Session.- Specified by:
runModel
in interfaceSession
- Throws:
SessionException
-
retrieveRunCompletionStatus
public void retrieveRunCompletionStatus() throws StatusException
Retrieves the run completion status (e.g. FAILURE) and sets it for this Session.- Specified by:
retrieveRunCompletionStatus
in interfaceSession
- Throws:
StatusException
-
findOutput
public List<MatchedFiles> findOutput(List<OutputPattern> patterns) throws StatusException
Finds the model output of that is the result of running this Session and returns that those files. In the case of remote output the output may be copied to local temporary location. The patterns used to identify output is specified in the filePatterns parameters.- Specified by:
findOutput
in interfaceSession
- Parameters:
patterns
- the patterns used to match potential output- Returns:
- the location of the output in a list of MatchedFiles. Each MatchedFiles object holds one or more files for a specific match.
- Throws:
StatusException
-
copyCompletionStatus
public void copyCompletionStatus(String outDirectory) throws StatusException
Copies the completion status from the host and directory where the model was run to the specified directory.- Specified by:
copyCompletionStatus
in interfaceSession
- Parameters:
outDirectory
-- Throws:
StatusException
-
createDonePoller
public Callable<Void> createDonePoller(long frequency)
Create a callable that returns with the model run by this Session is finished.- Specified by:
createDonePoller
in interfaceSession
- Returns:
- a callable that returns with the model run by this Session is finished.
-
-