AssignmentEventsInPool

toloka.metrics.pool_metrics.AssignmentEventsInPool | Source code

AssignmentEventsInPool(
self,
pool_id: str,
created_name: Optional[str] = None,
submitted_name: Optional[str] = None,
accepted_name: Optional[str] = None,
rejected_name: Optional[str] = None,
skipped_name: Optional[str] = None,
expired_name: Optional[str] = None,
cursor_time_lag: timedelta = ...,
join_events: bool = False,
*,
toloka_client: Optional[TolokaClient] = None,
atoloka_client: Optional[AsyncTolokaClient] = None,
timeout: timedelta = ...
)

Tracking the change of response statuses in the pool.

The metric is convenient for tracking that the pool is generally "alive" and working. If you want to track assignments counts, it's better to use AssignmentsInPool.

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.

created_nameOptional[str]

Metric name for a count of created events. Default None.

submitted_nameOptional[str]

Metric name for a count of submitted events. Default 'submitted_events_in_pool'.

accepted_name -

Metric name for a count of accepted events. Default 'accepted_events_in_pool'.

rejected_name -

Metric name for a count of rejected events. Default 'rejected_events_in_pool'.

skipped_nameOptional[str]

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

expired_nameOptional[str]

Metric name for a count of expired events. Default None.

join_eventsbool

Count all events in one point. Default False.

cursor_time_lagtimedelta

Time lag for cursor. This controls time lag between assignments being added and this metric being updated. See BaseCursor.time_lag for details and reasoning behind this.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
print(metric_dict)
collector = MetricCollector([AssignmentEventsInPool(pool_id, toloka_client=toloka_client)], print_metric)
asyncio.run(collector.run())
{
'submitted_events_in_pool': [(datetime.datetime(2021, 8, 11, 15, 13, 4, 31000), 5)],
'accepted_events_in_pool': [(datetime.datetime(2021, 8, 11, 15, 13, 3, 65000), 1)],
'rejected_events_in_pool': [],
}

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