Tracker#

top.core.tracker.Tracker class.

class Tracker[source]#

Bases: ABC

Task tracker backend interface definition.

__init__()#

Methods

__init__()

clear()

Clear the tracker from old/dangling tasks.

end_task(task)

Finish exisiting task.

get_active_tasks()

Get currently active tasks.

get_completed_tasks()

Get the backlog of completed tasks.

start_task(task)

Start a new task.

abstract clear()[source]#

Clear the tracker from old/dangling tasks.

For example if the server has

  • Crashed

  • Restarted

Get rid of any stale data.

Can be called on the web server start.

abstract start_task(task)[source]#

Start a new task.

Record a task started in the tracker backend.

Parameters:

task (Task) –

abstract end_task(task)[source]#

Finish exisiting task.

Mark task completed.

Parameters:

task (Task) –

abstract get_active_tasks()[source]#

Get currently active tasks.

Returns:

Map of (Processor id -> Task)

Return type:

Dict[Union[int, str], Task]

abstract get_completed_tasks()[source]#

Get the backlog of completed tasks.

Each backend can have N number of tasks in a ring buffer that are last completed.

Tasks are in the completion order. The most recently completed task is the first item in the list.

Returns:

List of past completed tasks that are in our past tasks buffer. The most recently completed task is the first item in the list.

Return type:

List[Task]