Toloka documentation

AssignmentsObserver | Source code

    toloka_client: Union[TolokaClient, AsyncTolokaClient],
    pool_id: str,
    name: Optional[str] = None

Observer for the pool's assignment events.

For usage with Pipeline.

Allow to register callbacks using the following methods: * on_created * on_submitted * on_accepted * on_rejected * on_skipped * on_expired

Corresponding assignment events will be passed to the triggered callbacks.

Parameters Description

Parameters Type Description
toloka_client AsyncInterfaceWrapper[Union[TolokaClient, AsyncTolokaClient]]

TolokaClient instance or async wrapper around it.

pool_id str

Pool ID.


Send submitted assignments for verification.

def handle_submitted(evets: List[AssignmentEvent]) -> None:
    verification_tasks = [create_veridication_task(item.assignment) for item in evets]
    toloka_client.create_tasks(verification_tasks, open_pool=True)
observer = AssignmentsObserver(toloka_client, pool_id='123')

Methods Summary

Method Description
inject None
on_accepted None
on_any_event None
on_created None
on_expired None
on_rejected None
on_skipped None
on_submitted None
register_callback Register given callable for given event type.