Toloka documentation

Operation

toloka.client.operations.Operation | Source code

Operation(
    self,
    *,
    id: Optional[str] = None,
    status: Union[Status, str, None] = None,
    submitted: Optional[datetime] = None,
    parameters: Optional[Parameters] = None,
    started: Optional[datetime] = None,
    finished: Optional[datetime] = None,
    progress: Optional[int] = None,
    details: Optional[Any] = None
)

Tracking Operation

Some API requests (opening and closing a pool, archiving a pool or a project, loading multiple tasks, awarding bonuses) are processed as asynchronous operations that run in the background.

Parameters Description

Parameters Type Description
id Optional[str]

Operation ID.

status Optional[Status]

The status of the operation.

submitted Optional[datetime]

The UTC date and time the request was sent.

parameters Optional[Parameters]

Operation parameters (depending on the operation type).

started Optional[datetime]

The UTC date and time the operation started.

finished Optional[datetime]

The UTC date and time the operation finished.

progress Optional[int]

The percentage of the operation completed.

details Optional[Any]

Details of the operation completion.

Methods Summary

Method Description
is_completed Returns True if the operation is completed. Status equals SUCCESS or FAIL.
raise_on_fail Raises FailedOperation exception if status is FAIL. Otherwise does nothing.