syne_tune.backend.simulator_backend.events module

class syne_tune.backend.simulator_backend.events.Event(trial_id)[source]

Bases: object

Base class for events dealt with in the simulator.

trial_id: int
class syne_tune.backend.simulator_backend.events.StartEvent(trial_id)[source]

Bases: Event

Start training evaluation function for trial_id. In fact, the function is run completely, and OnTrialResultEvent events and one CompleteEvent are generated.

trial_id: int
class syne_tune.backend.simulator_backend.events.CompleteEvent(trial_id, status)[source]

Bases: Event

Job for trial trial_id completes with status status. This is registered at the backend.

status: str
class syne_tune.backend.simulator_backend.events.StopEvent(trial_id)[source]

Bases: Event

Job for trial trial_id is stopped. This leads to all later events for trial_id to be deleted, and a new CompleteEvent.

trial_id: int
class syne_tune.backend.simulator_backend.events.OnTrialResultEvent(trial_id, result)[source]

Bases: Event

Result reported by some worker arrives at the backend and is registered there.

result: Dict[str, Any]
class syne_tune.backend.simulator_backend.events.SimulatorState(event_heap=None, events_added=0)[source]

Bases: object

Maintains the state of the simulator, in particular the event heap.

event_heap is the priority queue for events, the key being (time, cnt), where time is the event time, and cnt is a non-negative int used to break ties. When an event is added, the cnt value is taken from events_added. This means that ties are broken first_in_first_out.

push(event, event_time)[source]

Push new event onto heap

Parameters:
  • event (Event) –

  • event_time (float) –

remove_events(trial_id)[source]

Remove all events with trial_id equal to trial_id.

Parameters:

trial_id (int) –

next_until(time_until)[source]

Returns (and pops) event on top of heap, if event time is <= time_until. Otherwise, returns None.

Parameters:

time_until (float) –

Return type:

Optional[Tuple[float, Event]]

Returns: