toloka.client.TolokaClient.get_analytics
| Source code
get_analytics(self, stats: List[AnalyticsRequest])
Sends analytics requests to Toloka.
You can request up to 10 metrics at a time.
The values of different analytical metrics are returned in the details
field of the operation when it is completed.
Parameters | Type | Description |
---|---|---|
stats | List[AnalyticsRequest] | A list of analytics requests. |
Returns:
An object to track the progress of the operation.
Return type:
Examples:
The example shows how get the percentage of completed tasks in the pool.
from toloka.client.analytics_request import CompletionPercentagePoolAnalyticsoperation = toloka_client.get_analytics([CompletionPercentagePoolAnalytics(subject_id='1080020')])operation = toloka_client.wait_operation(operation)print(operation.details['value'][0])completed_task_percentage = operation.details['value'][0]['result']['value']
The example monitors the percentage of completed tasks in the pool every minute until the pool is closed.
from toloka.client.analytics_request import CompletionPercentagePoolAnalyticspool = toloka_client.get_pool('1080020')while not pool.is_closed(): op = toloka_client.get_analytics( [CompletionPercentagePoolAnalytics(subject_id=pool.id)] ) op = toloka_client.wait_operation(op) percentage = op.details['value'][0]['result']['value'] print(f'{percentage}%') time.sleep(60) pool = toloka_client.get_pool(pool.id)print('The pool is closed.')
Last updated: August 28, 2023