Class LocalSession

java.lang.Object
repast.simphony.batch.ssh.LocalSession
All Implemented Interfaces:
Session

public class LocalSession extends Object implements Session
Author:
Nick Collier
  • Constructor Details

    • LocalSession

      public LocalSession()
  • Method Details

    • getHost

      public String getHost()
      Description copied from interface: Session
      Gets the name or ip address of the remote host.
      Specified by:
      getHost in interface Session
      Returns:
      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.
      Specified by:
      getUser in interface Session
      Returns:
      the user account used to log into the remote host.
    • getId

      public String getId()
      Description copied from interface: Session
      Gets the id (user@host) of this Remote.
      Specified by:
      getId in interface Session
      Returns:
      the id (user@host) of this Remote.
    • getInstances

      public int getInstances()
      Description copied from interface: Session
      Gets the number of model instances to run on this Remote.
      Specified by:
      getInstances in interface Session
      Returns:
      the number of model instances to run on this Remote.
    • getInput

      public String getInput()
      Description copied from interface: Session
      Gets the file that contains parameter input for this Session.
      Specified by:
      getInput in interface Session
      Returns:
      the parameter input for this remote.
    • setInput

      public void setInput(String input)
      Description copied from interface: Session
      Sets the file that contains the parameter input for this Session.
      Specified by:
      setInput in interface 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 interface Session
      Parameters:
      instance - the instance id
      status - the status
    • getStatus

      public RunningStatus getStatus(int instance)
      Description copied from interface: Session
      Gets the status of the specified instance.
      Specified by:
      getStatus in interface Session
      Returns:
      the status of the specified instance.
    • createDonePoller

      public Callable<Void> createDonePoller(long frequency)
      Description copied from interface: Session
      Create a callable that returns with the model run by this Session is finished.
      Specified by:
      createDonePoller in interface Session
      Returns:
      a callable that returns with the model run by this Session is finished.
    • copyCompletionStatus

      public void copyCompletionStatus(String outDirectory) throws StatusException
      Description copied from interface: Session
      Copies the completion status from the host and directory where the model was run to the specified directory.
      Specified by:
      copyCompletionStatus in interface Session
      Throws:
      StatusException
    • findOutput

      public List<MatchedFiles> findOutput(List<OutputPattern> patterns) throws StatusException
      Finds the model output that is the result of running this Session and returns 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 interface Session
      Parameters:
      patterns - the OutputPatterns of the files to find.
      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
    • retrieveRunCompletionStatus

      public void retrieveRunCompletionStatus() throws StatusException
      Description copied from interface: Session
      Retrieves the run completion status (e.g. FAILURE) and sets it for this Session.
      Specified by:
      retrieveRunCompletionStatus in interface Session
      Throws:
      StatusException
    • runModel

      public void runModel() throws SessionException
      Description copied from interface: Session
      Runs the model for this Session.
      Specified by:
      runModel in interface Session
      Throws:
      SessionException
    • 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 interface Session
      Parameters:
      directory - the directory to copy the model archive into
      Throws:
      ModelArchiveConfiguratorException
      SessionException