Skip to content

Executor

Runs one part of a deployment, configured by a TConfig.

Executors form a tree: a SmartphoneDeploymentExecutor runs a TaskControlExecutor per task control, which runs a TriggerExecutor and a TaskExecutor, which runs a Probe per measure.

The behavior of an executor is controlled by its lifecycle methods: initialize, resume, pause, and dispose. A paused executor can be resumed again. state holds the current ExecutorState and stateEvents is a broadcast stream of state changes. If an error occurs, the state becomes ExecutorState.Undefined.

Collected data comes out of the measurements stream. To listen to all measurements from all studies on this phone, use SmartPhoneClientManager.measurements.

Implementers

Constructors

Executor

Executor<TConfig>()

Properties

configuration

TConfig? get configuration

The configuration of this executor as set in initialize.

deployment

SmartphoneDeployment? get deployment

The deployment that this executor is part of executing.

measurements

Stream<Measurement> get measurements

The stream of Measurement collected by this executor.

samplingState

SamplingState get samplingState

The runtime sampling state of this executor.

state

ExecutorState get state

The runtime state of this executor.

stateEvents

Stream<ExecutorState> get stateEvents

The runtime state changes of this executor.

Methods

dispose

void dispose()

Disposes this executor.

If not already paused, pause will be called first.

Once disposed, the executor cannot be used anymore and nothing will happen if any of the life cycle methods are called.

initialize

void initialize(
  1. TConfig configuration, [
  2. SmartphoneDeployment? deployment
])

Configures and initializes the executor. Call before resume.

pause

void pause()

Pauses the executor until resume is called.

pauseButShouldBeResumed

void pauseButShouldBeResumed()

Pauses the executor and marks it to be resumed later.

The state becomes ExecutorState.PausedButShouldBeResumed, e.g. when its device is temporarily disconnected.

resume

void resume()

Starts or resumes the executor.