Interface IHeadlessApplication

All Known Implementing Classes:
HeadlessApplication

public interface IHeadlessApplication
  • Method Details

    • submitTask

      boolean submitTask(ShortId runId, String scenarioPath, int seed)
      Submit a new simulation task. If there is a known task with the same runId, a new task does not get submitted, false is returned, no exception is thrown.
      Parameters:
      runId - unique id of the task
      scenarioPath - full path to a local file that contains a scenario to be used for the task
      seed - random seed (a task parameter)
      Returns:
      true if there is no known task with the same runId; false otherwise
    • stopTask

      void stopTask(ShortId runId)
      Gracefully stop a started task, or cancel a submitted but not yet started task.

      For a task whose state is already final, nothing is done.

      If the task is not known, nothing is done, no exception is thrown.

      This method is idempotent - it may be called multiple times for the same task id.

      Parameters:
      runId - unique id of the task
    • stopAll

      void stopAll()
      Gracefully stop/cancel all known tasks, if any. This is equivalent to calling stopTask(ShortId) for each known task.
    • taskIsKnown

      boolean taskIsKnown(ShortId runId)
      Returns true if the application has a task with this runId. The task may be in any state. A task is known since it is submitted and until it is deleted.
    • hasTasksInProgress

      boolean hasTasksInProgress()
      Report if there are any tasks currently in progress. This method is used during application shutdown to check that all tasks have been stopped.
    • getProgressAndStatus

      List<ProgressItem> getProgressAndStatus()
      Return the current completed fraction and status of all known tasks.
    • getResult

      Result getResult(ShortId runId)
      Return the result of the task execution.
      Parameters:
      runId - task id
      Returns:
      a non-null Result object if the task is found by its id and is in a final state; null otherwise
    • deleteTask

      boolean deleteTask(ShortId runId)
      Delete a task.

      A deleted task is not included in the getProgressAndStatus() result, nor can its result be fetched by getResult(ShortId).

      Only a known task for which one of the following holds true may be deleted:
      1. The task has been canceled, or
      2. There were scenario loading errors, or
      3. The task is in a final state, or

      Parameters:
      runId - task id
      Returns:
      true if the task is in a correct state for deletion; false otherwise