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

ParametersTypeDescription
pool_idstr

From which pool track metrics.

workers_nameOptional[str]

Metric name for a count of workers.

interval_hoursint

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

MethodDescription
get_line_namesReturns a list of metric names that can be generated by this class instance.

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming