Toloka documentation

TasksInPool

toloka.metrics.pool_metrics.TasksInPool | Source code

TasksInPool(
    self,
    pool_id: str,
    tasks_name: Optional[str] = None,
    *,
    toloka_client: Optional[TolokaClient] = None,
    atoloka_client: Optional[AsyncTolokaClient] = None,
    timeout: timedelta = ...
)

The number of tasks in the pool. Not new tasks. All tasks on each step.

Parameters Description

Parameters Type Description
pool_id str

From which pool track metrics.

tasks_name Optional[str]

Metric name for a count of tasks.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
    print(metric_dict)

collector = MetricCollector([TasksInPool(pool_id, toloka_client=toloka_client)], print_metric)
asyncio.run(collector.run())
'tasks_count': [(datetime.datetime(2021, 11, 18, 9, 36, 34, 163000), 40)],

}

Methods Summary

Method Description
get_line_names Returns a list of metric names that can be generated by this class instance.