Miner | Salzburg Research > Documentation > Programming MINER > Starting and Scheduling an Execution

Starting and Scheduling an Execution

A Scenario that has been successfully submitted to the MINER Server can be executed immediately or scheduled for an Execution at a later time.

Starting an Execution

  • Execute immediately, no stop time.
    scenario.execute()
  • Execute immediately for the given duration.
    scenario.execute(duration)

Scheduling an Execution

  • Schedule Execution at offset seconds from now with no stop time.
    scenario.schedule(offset)
  • Schedule Execution at offset seconds from now and for the given duration.
    scenario.schedule(offset, duration)
  • Schedule for Execution at start time with no stop time.
     scenario.schedule(start)
  • Schedule for Execution at start time to run until stop time.
    scenario.schedule(start, stop)

Note that with the last 2 methods the client sets the start (and stop) time whereas in the other cases the Server computes them based on its local time and the given offset/duration. In case the client sets the absolute start/stop time a potential clock offset to the Server (and the ToolProxies) must be taken into consideration. Otherwise, the resulting start/stop times may differ from the user’s expectation.

As shown in the Javadoc of the Scenario class, there are additional methods for scheduling and executing a Scenario that also allow for an execution description to be set.

All the above methods return an Execution object which is used to control the Execution and retrieve results from it.

Execution exec = scenario.execute();

Checking if an Execution is finished

The isFinished() method of an Execution returns true if the Execution has completely finished, i.e. all activities have ended on the ToolProxies as well as the MINER Server.

boolean finished = exec.isFinished()

Stopping an Execution

If an Execution was scheduled without a stop date, e.g. via execute() or schedule(start), it must be explicitly stopped by the user.

exec.stop()

This method signals the MINER Server to stop the Execution. The Server will forward this request to all ToolProxies involved in the Execution and they will initialize the Execution shutdown sequence. The stop method blocks until the Execution is completely finished at the MINER Core, i.e. until isFinished() returns true.