Interface IHeadlessApplication
- All Known Implementing Classes:
HeadlessApplication
public interface IHeadlessApplication
-
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteTask(ShortId runId) Delete a task.Return the current completed fraction andstatusof allknown tasks.Return the result of the task execution.booleanReport if there are any tasks currently in progress.voidstopAll()Gracefully stop/cancel all known tasks, if any.voidGracefully stop a started task, or cancel a submitted but not yet started task.booleansubmitTask(ShortId runId, String scenarioPath, int seed) Submit a new simulation task.booleantaskIsKnown(ShortId runId) Returns true if the application has a task with this runId.
-
Method Details
-
submitTask
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 taskscenarioPath- full path to a local file that contains a scenario to be used for the taskseed- random seed (a task parameter)- Returns:
- true if there is no known task with the same runId; false otherwise
-
stopTask
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 callingstopTask(ShortId)for each known task. -
taskIsKnown
-
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 andstatusof allknown tasks. -
getResult
Return the result of the task execution.- Parameters:
runId- task id- Returns:
- a non-null
Resultobject if the task is found by its id and is in afinal state; null otherwise
-
deleteTask
Delete a task.A deleted task is not included in the
getProgressAndStatus()result, nor can its result be fetched bygetResult(ShortId).Only a
known taskfor 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 afinal state, or- Parameters:
runId- task id- Returns:
- true if the task is in a correct state for deletion; false otherwise
-