Toloka documentation

WorkersByFilterOnPool

toloka.metrics.pool_metrics.WorkersByFilterOnPool | Source code

WorkersByFilterOnPool(
    self,
    pool_id: str,
    workers_name: Optional[str] = None,
    interval_hours: int = 1,
    *,
    toloka_client: Optional[TolokaClient] = None,
    atoloka_client: Optional[AsyncTolokaClient] = None,
    timeout: timedelta = ...
)

The number of active Tolokers matching the pool filters for the last hours (default 1 hour)

Parameters Description

Parameters Type Description
pool_id str

From which pool track metrics.

workers_name Optional[str]

Metric name for a count of workers.

interval_hours int

Counts unique workers on this hours interval. Default 1.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
    print(metric_dict)

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

}

Methods Summary

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