Class DefaultRemoteRunHelper

java.lang.Object
com.amalgamasimulation.desktop.ui.studies.DefaultRemoteRunHelper
All Implemented Interfaces:
IRemoteRunHelper

public class DefaultRemoteRunHelper extends Object implements IRemoteRunHelper
Default implementation of IRemoteRunHelper. Does not support remote experiment execution.
  • Constructor Details

    • DefaultRemoteRunHelper

      public DefaultRemoteRunHelper()
  • Method Details

    • supportsRemoteRun

      public boolean supportsRemoteRun()
      Description copied from interface: IRemoteRunHelper
      Returns true iff remote study execution has been implemented for this product, i.e., for the combination of the product ID and the client suffix.
      Specified by:
      supportsRemoteRun in interface IRemoteRunHelper
    • createRemoteRun

      public Run<?> createRemoteRun(org.eclipse.emf.ecore.EObject scenario, int seed)
      Description copied from interface: IRemoteRunHelper
      How to create an instance of remote run for the given scenario and random number seed?

      A remote run is the run performed on the server, not on the current machine.

      At some point of time, a user might want to run some simulation experiment remotely on the server rather than locally. In order to do so, a new instance of Run will be created by calling this method overridden in the concrete simulation application.

      The availability of the server will be checked by calling IRemoteRunHelper.isServerAvailable() method that must also be overridden in the concrete simulation application.

      Specified by:
      createRemoteRun in interface IRemoteRunHelper
      Parameters:
      scenario - the scenario for which the run must be created
      seed - the random number seed for which the run must be created
      Returns:
      A new instance of Run
      See Also:
    • createReattachedRemoteRun

      public Run<?> createReattachedRemoteRun(ShortId id, int seed)
      Description copied from interface: IRemoteRunHelper
      How to create a run that represents a previously launched remote experiment with the given run id?

      A remote run is the run performed on the server, not on the current machine.

      At some point of time, a user might want to run an experiment remotely. Sometimes a remotely running experiment may take a long time to complete. In this case the user does not have to wait till the calculation is done. Instead, the user can save the study, then close the application, then, after a while, open the application again and open the saved study.

      At the moment when the study is loaded, this method is called for remotely running experiments of the loaded study.
      This method should return a fully functional Run that reflects the current status of the remotely running experiment and gives full control of it, including experiment interruption (see Run.stop()).

      Specified by:
      createReattachedRemoteRun in interface IRemoteRunHelper
      Parameters:
      id - the id for which the run must be created; it is guaranteed by the caller that such run id is known to the server
      seed - the random number seed for which the run must be created
      Returns:
      A new instance of Run attached to the remotely executing run
      See Also:
    • checkRemoteRunIsKnown

      public boolean checkRemoteRunIsKnown(ShortId id)
      Description copied from interface: IRemoteRunHelper
      Is there an experiment on the server with the provided run id?
      Specified by:
      checkRemoteRunIsKnown in interface IRemoteRunHelper
      Parameters:
      id - run id
      Returns:
      true if the Cloud Server knows such a run; false otherwise
    • isServerAvailable

      public boolean isServerAvailable()
      Description copied from interface: IRemoteRunHelper
      Is remote execution of simulation runs available?

      The following conditions must hold:
      1. Remote execution has been implemented for this application. See DesktopAppInfo class and its supportsRemoteRun() method for details.
      2. The remote server is available.
      3. The remote server reports that it can actually execute an experiment for this particular version of the application.

      Study part will periodically call this method to check if the server is available and enable/disable the corresponding UI elements accordingly.

      Note that this method may take a long time to complete due to network issues. It should therefore only be called outside the UI thread.

      Specified by:
      isServerAvailable in interface IRemoteRunHelper
      Returns:
      true if the remote experiment execution has been implemented for this application, the server is available, and it reports that it can execute an experiment for this particular version of the application;
      false otherwise