actuator.scheduler module

class actuator.scheduler.DeviceState(agent_id, task_id, time_remaining)

Bases: tuple

property agent_id

Alias for field number 0

property task_id

Alias for field number 1

property time_remaining

Alias for field number 2

class actuator.scheduler.RequestResult(success, data, info_string)

Bases: tuple

property data

Alias for field number 1

property info_string

Alias for field number 2

property success

Alias for field number 0

class actuator.scheduler.Schedule[source]

Bases: object

check_availability(time_slot)[source]
finished(now)[source]
get_conflicts(other)[source]

Returns a list of our time_slices that conflict with the other schedule

get_current_slot(now)[source]
get_next_event_time(now)[source]

Run this to know when to the next state change is going to happen with this schedule

get_schedule()[source]
make_current(now)[source]

Should be called before working with a schedule. Updates the state to the schedule to eliminate stuff in the past.

prune_to_current(grace_time, now)[source]

Use this to prune a schedule due to preemption.

schedule_slot(time_slot)[source]
exception actuator.scheduler.ScheduleError[source]

Bases: Exception

class actuator.scheduler.ScheduleManager(grace_time, now=None, save_state_callback=None, initial_state_string=None)[source]

Bases: object

cancel_task(agent_id, task_id, now)[source]
get_next_event_time(now)[source]
get_schedule_state(now)[source]
load_state(now, initial_state_string)[source]
request_slots(agent_id, id_, requests, priority, now=None)[source]
save_state(now)[source]
set_grace_period(seconds)[source]
class actuator.scheduler.Task(agent_id, priority, requests)[source]

Bases: object

STATE_FINISHED = 'FINISHED'
STATE_PREEMPTED = 'PREEMPTED'
STATE_PRE_RUN = 'PRE_RUN'
STATE_RUNNING = 'RUNNING'
change_state(new_state)[source]
check_can_preempt_other(other)[source]
get_conflicts(other)[source]
get_current_slots(now)[source]
get_next_event_time(now)[source]
make_current(now)[source]
populate_schedule(requests)[source]
preempt(grace_time, now)[source]

Return true if there are time slots that have a grace period left

class actuator.scheduler.TimeSlice(start=None, end=None)[source]

Bases: object

contains_include_start(other)[source]

Similar to == or “in” but includes time == self.start

property end
property start
stretch_to_include(time_slice)[source]