biometrics_tracker.main.scheduler module

class biometrics_tracker.main.scheduler.Scheduler(config_info: ConfigInfo, queue_mgr: Queues, start_dispatcher: bool, completion_replyto: Optional[Callable] = None, thread_sleep_seconds: int = 300, queue_sleep_seconds: int = 10)

Bases: Thread

A threaded class the used the contents of the People and ScheduleEntry database tables to present single entry windows for according to the schedule

check_response_queue(block: bool, caller: str)

Check the database response queue for responses to requests

Parameters
  • block – should the queue check be a blocking check

  • caller – a string name of the invoking method for inclusion in log entries

Returns

None

process_people(msg: PeopleMsg)

Received a list of people and processes each entry in the list

Parameters

msg (biometrics_tracker.ipc.messages.PeopleMsg) – a message containing a list of Person instances

Returns

None

process_schedule_entries(msg: ScheduleEntriesMsg)

Processes the ScheduleEntry’s for a single person, checking each one to see if a job should be triggered

Parameters

msg (biometrics_tracker.ipc.messages.ScheduleEntriesMsg) – a database response message containing a list of ScheduleEntry’s

Returns

None

retrieve_people()

Issues a PersonReqMsg to the database to retrieve a list of person_id’s, passing control onto the process_people method through the replyto callback.

Returns

None

retrieve_schedules(replyto: Callable, person_id: str)

Issue a ScheduleEntryReqMsg to the database to retrieve the ScheduleEntry’s for a person

Parameters
  • replyto (Callable) – the method or function to serve as the ‘replyto’ callback

  • person_id (str) – the ID of the person whose ScheduleEntry’s are to be retrieved

Returns

None

run() None

Override the threading.Thread run method. Loops until boolean quit property is True, issuing a database request to retrieve a list of people, which chains through successive replyto callbacks to process the ScheduleEntry’s for each person and kicks of jobs that present biometrics_tracking.gui.ScheduledEntryWindow instances

Returns

None

:TODO This process should run once, and then (maybe) start a thread to process the schedule jobs via schedule.run_pending

biometrics_tracker.main.scheduler.run_scheduled_entry(**kwargs)

This method creates and runs an instance of biometrics_tracker.gui.ScheduledEntryWindow. It is started as a separate process because the Tkinter event loop must be in the main thread.

Parameters
Returns

None