AssignmentsInPool

toloka.metrics.pool_metrics.AssignmentsInPool | Source code

AssignmentsInPool(
self,
pool_id: str,
submitted_name: Optional[str] = None,
accepted_name: Optional[str] = None,
rejected_name: Optional[str] = None,
skipped_name: Optional[str] = None,
*,
toloka_client: Optional[TolokaClient] = None,
atoloka_client: Optional[AsyncTolokaClient] = None,
timeout: timedelta = ...
)

Tracking the count of assignments in different states in the pool.

Metrics starts gathering if they name are set. If the metric name is set to None, they don't gathering.

Parameters description

ParametersTypeDescription
pool_idstr

From which pool track metrics.

submitted_nameOptional[str]

Metric name for a count of submitted assignments. Default 'submitted_assignments_in_pool'.

accepted_name -

Metric name for a count of accepted assignments. Default 'accepted_assignments_in_pool'.

rejected_name -

Metric name for a count of rejected assignments. Default 'rejected_assignments_in_pool'.

skipped_nameOptional[str]

Metric name for a count of skipped assignments. Default None.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
print(metric_dict)
collector = MetricCollector([AssignmentsInPool(pool_id, toloka_client=toloka_client)], print_metric)
asyncio.run(collector.run())
{
'rejected_assignments_in_pool': [(datetime.datetime(2021, 8, 12, 10, 4, 44, 895232), 0)],
'submitted_assignments_in_pool': [(datetime.datetime(2021, 8, 12, 10, 4, 45, 321904), 75)],
'accepted_assignments_in_pool': [(datetime.datetime(2021, 8, 12, 10, 4, 45, 951156), 75)],
}

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