ax.runners
BoTorch Test Problem
SingleRunningTrialMixin
- class ax.runners.single_running_trial_mixin.SingleRunningTrialMixin[source]
Bases:
object
Mixin for Runners with a single running trial.
This mixin implements a simple poll_trial_status method that allows for a single running trial (the latest running trial). The returned status of trials that currently are marked as running is completed.
- poll_trial_status(trials: Iterable[BaseTrial]) dict[TrialStatus, set[int]] [source]
Checks the status of any non-terminal trials and returns their indices as a mapping from TrialStatus to a list of indices. Required for runners used with Ax
Scheduler
.NOTE: Does not need to handle waiting between polling calls while trials are running; this function should just perform a single poll.
- Parameters:
trials – Trials to poll.
- Returns:
A dictionary mapping TrialStatus to a list of trial indices that have the respective status at the time of the polling. This does not need to include trials that at the time of polling already have a terminal (ABANDONED, FAILED, COMPLETED) status (but it may).
Synthetic Runner
- class ax.runners.synthetic.SyntheticRunner(dummy_metadata: str | None = None)[source]
Bases:
Runner
Class for synthetic or dummy runner.
Currently acts as a shell runner, only creating a name.
- poll_trial_status(trials: Iterable[BaseTrial]) dict[TrialStatus, set[int]] [source]
Checks the status of any non-terminal trials and returns their indices as a mapping from TrialStatus to a list of indices. Required for runners used with Ax
Scheduler
.NOTE: Does not need to handle waiting between polling calls while trials are running; this function should just perform a single poll.
- Parameters:
trials – Trials to poll.
- Returns:
A dictionary mapping TrialStatus to a list of trial indices that have the respective status at the time of the polling. This does not need to include trials that at the time of polling already have a terminal (ABANDONED, FAILED, COMPLETED) status (but it may).
Simulated Backend Runner
- class ax.runners.simulated_backend.SimulatedBackendRunner(simulator: BackendSimulator, sample_runtime_func: Callable[[BaseTrial], float] | None = None)[source]
Bases:
Runner
Class for a runner that works with the BackendSimulator.
- poll_trial_status(trials: Iterable[BaseTrial]) dict[TrialStatus, set[int]] [source]
Poll trial status from the
BackendSimulator
. NOTE: TheScheduler
currently marks trials as running when they are created, but some of these trials may actually be in queued on theBackendSimulator
.- Returns:
A Dict mapping statuses to sets of trial indices.
- run(trial: BaseTrial) dict[str, float] [source]
Start a trial on the BackendSimulator.
- Parameters:
trial – Trial to deploy via the runner.
- Returns:
Dict containing the sampled runtime of the trial.
- stop(trial: BaseTrial, reason: str | None = None) dict[str, Any] [source]
Stop a trial on the BackendSimulator.
- Parameters:
trial – Trial to stop on the simulator.
reason – A message containing information why the trial is to be stopped.
- Returns:
A dictionary containing a single key “reason” that maps to the reason passed to the function. If no reason was given, returns an empty dictionary.
- ax.runners.simulated_backend.sample_runtime_unif(trial: BaseTrial, low: float = 1.0, high: float = 5.0) float [source]
Return a uniform runtime in [low, high]
- Parameters:
trial – Trial for which to sample runtime.
low – Lower bound of uniform runtime distribution.
high – Upper bound of uniform runtime distribution.
- Returns:
A float representing the simulated trial runtime.