Track

Track Storage Protocol

Implement a storage protocol to allow Orion to use track as a storage method.

class orion.storage.track.Track(uri)[source]

Implement a generic protocol to allow Orion to communicate using different storage backend

Parameters:
uri: str
Track backend to use for storage; the format is as follow

protocol://[username:password@]host1[:port1][,…hostN[:portN]]][/[database][?options]]

Attributes:
instance

Methods

count_broken_trials(experiment) Count the number of broken trials
count_completed_trials(experiment) Count the number of completed trials
create_experiment(config) Insert a new experiment inside the database
fetch_experiments(query[, selection]) Fetch all experiments that match the query
fetch_lost_trials(experiment) Fetch all trials that have a heartbeat older than some given time delta (5 minutes by default)
fetch_noncompleted_trials(experiment) Fetch all non completed trials
fetch_pending_trials(experiment) See orion.storage.base.BaseStorageProtocol.fetch_pending_trials()
fetch_trials([experiment, uid, where]) See orion.storage.base.BaseStorageProtocol.fetch_trials()
fetch_trials_by_status(experiment, status) Fetch all trials with the given status
get_trial([trial, uid]) See orion.storage.base.BaseStorageProtocol.get_trial()
push_trial_results(trial) Push the trial’s results to the database
register_lie(trial) Register a fake trial created by the strategist.
register_trial(trial) Create a new trial to be executed
reserve_trial(experiment) Select a pending trial and reserve it for the worker
retrieve_result(trial, *args, **kwargs) Fetch the result from a given medium (file, db, socket, etc..) for a given trial and insert it into the trial object
set_trial_status(trial, status[, heartbeat, was]) Update the trial status and the heartbeat
update_experiment([experiment, uid, where]) See orion.storage.base.BaseStorageProtocol.update_experiment()
update_heartbeat(trial) Update trial’s heartbeat
update_trial([trial, uid]) Update the fields of a given trials
update_trials([experiment, uid, where]) See orion.storage.base.BaseStorageProtocol.update_trials()
count_broken_trials(experiment)[source]

Count the number of broken trials

count_completed_trials(experiment)[source]

Count the number of completed trials

create_experiment(config)[source]

Insert a new experiment inside the database

fetch_experiments(query, selection=None)[source]

Fetch all experiments that match the query

fetch_lost_trials(experiment)[source]

Fetch all trials that have a heartbeat older than some given time delta (5 minutes by default)

fetch_noncompleted_trials(experiment)[source]

Fetch all non completed trials

fetch_pending_trials(experiment)[source]

See orion.storage.base.BaseStorageProtocol.fetch_pending_trials()

fetch_trials(experiment=None, uid=None, where=None)[source]

See orion.storage.base.BaseStorageProtocol.fetch_trials()

fetch_trials_by_status(experiment, status)[source]

Fetch all trials with the given status

get_trial(trial=None, uid=None)[source]

See orion.storage.base.BaseStorageProtocol.get_trial()

push_trial_results(trial)[source]

Push the trial’s results to the database

register_lie(trial)[source]

Register a fake trial created by the strategist.

The main difference between fake trial and original ones is the addition of a fake objective result, and status being set to completed. The id of the fake trial is different than the id of the original trial, but the original id can be computed using the hashcode on parameters of the fake trial. See mod:orion.core.worker.strategy for more information and the Strategist object and generation of fake trials.

Parameters:
trial: `Trial` object

Fake trial to register in the database

register_trial(trial)[source]

Create a new trial to be executed

reserve_trial(experiment)[source]

Select a pending trial and reserve it for the worker

retrieve_result(trial, *args, **kwargs)[source]

Fetch the result from a given medium (file, db, socket, etc..) for a given trial and insert it into the trial object

set_trial_status(trial, status, heartbeat=None, was=None)[source]

Update the trial status and the heartbeat

Raises:
FailedUpdate

The exception is raised if the status of the trial object does not match the status in the database

update_experiment(experiment=None, uid=None, where=None, **kwargs)[source]

See orion.storage.base.BaseStorageProtocol.update_experiment()

update_heartbeat(trial)[source]

Update trial’s heartbeat

update_trial(trial=None, uid=None, **kwargs)[source]

Update the fields of a given trials

Parameters:
trial: Trial

Trial object to update

where: Optional[dict]

constraint trial must respect

kwargs: dict

a dictionary of fields to update

Returns:
returns 1 if the underlying storage was updated else 0
update_trials(experiment=None, uid=None, where=None, **kwargs)[source]

See orion.storage.base.BaseStorageProtocol.update_trials()

class orion.storage.track.TrialAdapter(storage_trial, orion_trial=None, objective=None)[source]

Mock Trial, see Trial

Parameters:
storage_trial

Track trial object

orion_trial

Orion trial object

objective: str

objective key

Attributes:
end_time

See Trial

experiment

See Trial

gradient

See Trial

hash_params

See Trial

hearbeat

See Trial

heartbeat

Trial Heartbeat

id

See Trial

lie

See Trial

objective

See Trial

params

See Trial

parents

See Trial

results

See Trial

status

See Trial

submit_time

See Trial

Methods

to_dict() See Trial
end_time

See Trial

experiment

See Trial

gradient

See Trial

hash_params

See Trial

hearbeat

See Trial

heartbeat

Trial Heartbeat

id

See Trial

lie

See Trial

objective

See Trial

params

See Trial

parents

See Trial

results

See Trial

status

See Trial

submit_time

See Trial

to_dict()[source]

See Trial

orion.storage.track.add_leading_slash(name)[source]

Add leading slash

orion.storage.track.convert_track_status(status)[source]

Convert track status to orion status

orion.storage.track.experiment_uid(exp=None, name=None, version=None)[source]

Return an experiment uid from its name and version for Track

orion.storage.track.get_track_status(val)[source]

Convert orion status to track status

orion.storage.track.remove_leading_slash(name)[source]

Remove leading slash

orion.storage.track.to_epoch(date)[source]

Convert datetime class into seconds since epochs