Trackers

Tracker class

This an ABC for a tracker that monitors a Python queue.

Contained within the namespace is a class called TrackerEvent, which is also an ABC. This is the kind of event that will be placed in the queue the tracker is monitoring. Each child class of TrackerEvent needs to know how to update the state of the tracker.

Each child has to implement a tracked_values method which tells what values the tracker is tracking - this is so it can pretty-print them.

All child classes have to implement an allowed_events class variable.

class edsl.trackers.Tracker.Tracker(event_queue, verbose=False)

Bases: ABC

Meant to be single-threaded.

class TrackerEvent

Bases: ABC

Each child event needs to know how to update the state of the tracker.

abstract apply(tracker)

Update the state of the tracker.

abstract allowed_events() set

What events (classes) are allowed to be placed in the queue?

get_from_queue()

Get events from the queue and stores them in a list.

It runs until the event_queue is empty.

process_event(event)

Process an event from the event queue.

show_status()

Print the status of the interview manager.

abstract tracked_values() dict

What values are tracked by this tracker (should be flat dictionary)?

TrackerAPI class

This tracker tracks API calls.

class edsl.trackers.TrackerAPI.TrackerAPI(lock, monitored_queue, tokens_per_minute_k=90, requests_per_minute_k=2)

Bases: Tracker

This tracker tracks API calls.

class APICallDetails(details)

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Update the state of the tracker.

allowed_events()

Return the allowed events.

classmethod fromJSON(filename)

Load a tracker from a JSON file.

status()

Print the status of the interview manager, while interviews are doing on.

toJSON(filename='sample_data.json')

Save the tracker to a JSON file.

tracked_values() dict

Return the tracked values.

usage_rates(last_seconds=60)

Compute the usage rates over the last last_seconds seconds.

class edsl.trackers.TrackerAPI.UsageRates(estimated_tokens_per_minute_k, pct_of_tpm_limit, estimated_requests_per_minute_k, pct_of_rpm_limit)

Bases: tuple

estimated_requests_per_minute_k

Alias for field number 2

estimated_tokens_per_minute_k

Alias for field number 0

pct_of_rpm_limit

Alias for field number 3

pct_of_tpm_limit

Alias for field number 1

TrackerTasks class

This module contains a tracker that tracks the progress of a set of tasks.

class edsl.trackers.TrackerTasks.TrackerTasks(num_interviews, lock, monitored_queue)

Bases: Tracker

This tracker tracks the progress of a set of tasks.

class TaskCompleted

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Each child class of TrackerEvent needs to know how to update the state of the tracker.

class TaskStarted

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Each child class of TrackerEvent needs to know how to update the state of the tracker.

class ThreadStatus(thread_id, status)

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Each child class of TrackerEvent needs to know how to update the state of the tracker.

class WorkerActivated

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Each child class of TrackerEvent needs to know how to update the state of the tracker.

class WorkerDeactivated

Bases: TrackerEvent

This is the kind of event that will be placed in the queue the tracker is monitoring.

apply(tracker)

Each child class of TrackerEvent needs to know how to update the state of the tracker.

allowed_events()

Return the allowed events.

property percentage_complete

Return the percentage of interviews that have been completed.

tracked_values() dict

Return the tracked values.