Toloka documentation


toloka.metrics.pool_metrics.BansInPool | Source code

    pool_id: str,
    count_name: Optional[str] = None,
    filter_by_comment: Optional[Dict[str, str]] = None,
    join_events: bool = False,
    toloka_client: Optional[TolokaClient] = None,
    atoloka_client: Optional[AsyncTolokaClient] = None,
    timeout: timedelta = ...

Tracking Toloker restrictions in a pool.

Be careful: if you set in quality controls to ban Tolokers 'on project', bans 'on pool' will never happen.

Parameters Description

Parameters Type Description
pool_id str

From which pool track metrics.

count_name Optional[str]

Metric name for a count of bans.

filter_by_comment Optional[Dict[str, str]]

Allow to split Toloker restriction into several lines based on comment. Dictionary where, key - comment string, and value - name for line in which will be aggregated bans with this comments.

join_events bool

Count all events in one point. Default False.


How to collect this metrics:

def print_metric(metric_dict):

collector = MetricCollector([BansInPool(pool_id, toloka_client=toloka_client)], print_metric)
'bans_count': [(datetime.datetime(2021, 11, 18, 13, 30, 11, 522000), 1)],


How to split bans onto several metrics.

collector = MetricCollector(
            filter_by_comment={'fast answers': 'fast', 'bad quality on honeypots': 'honeypots'}
'honeypots': [(datetime.datetime(2021, 11, 18, 13, 32, 52, 475000), 1)],
'fast': [(datetime.datetime(2021, 11, 18, 13, 32, 50, 453000), 1)],


Methods Summary

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