Consumer

TODO

orion.core.worker.consumer – Evaluate objective on a set of parameters

class orion.core.worker.consumer.Consumer(experiment)[source]

Consume a trial by using it to initialize a black-box box to evaluate it.

It uses an Experiment object to push an evaluated trial, if results are delivered to the worker process successfully.

It forks another process which executes user’s script with the suggested options. It expects results to be written in a JSON file, whose path has been defined in a special orion environmental variable which is set into the child process’ environment.

Methods

consume(self, trial) Execute user’s script as a block box using the options contained within trial.
execute_process(self, cmd_args, environ) Facilitate launching a black-box trial.
get_execution_environment(self, trial[, …]) Set a few environment variables to allow users and underlying processes to know if they are running under orion.
consume(self, trial)[source]

Execute user’s script as a block box using the options contained within trial.

execute_process(self, cmd_args, environ)[source]

Facilitate launching a black-box trial.

get_execution_environment(self, trial, results_file='results.log')[source]

Set a few environment variables to allow users and underlying processes to know if they are running under orion.

Parameters:
results_file: str

file used to store results, this is only used by the legacy protocol

trial: Trial

reference to the trial object that is going to be run

Notes

This function defines the environment variables described below

ORION_EXPERIMENT_ID

Current experiment that is being ran.

ORION_EXPERIMENT_NAME

Name of the experiment the worker is currently working on.

ORION_EXPERIMENT_VERSION

Version of the experiment the worker is currently working on.

ORION_TRIAL_ID

Current trial id that is currently being executed in this process.

ORION_WORKING_DIRECTORY

Trial’s current working directory.

ORION_RESULTS_PATH

Trial’s results file that is read by the legacy protocol to get the results of the trial after a successful run.

exception orion.core.worker.consumer.ExecutionError[source]

Error raised when Orion is unable to execute the user’s script without errors.