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
)

A base class for Toloka operations.

Some API requests start asynchronous operations in Toloka. Classes derived from Operation are used to track them. The examples of asynchronous operations are opening a pool, archiving a project, loading multiple tasks.

Parameters description

ParametersTypeDescription
idOptional[str]

The ID of the operation.

statusOptional[Status]

The status of the operation.

submittedOptional[datetime]

The UTC date and time when the operation was requested.

parametersOptional[Parameters]

Parameters of the request that started the operation.

startedOptional[datetime]

The UTC date and time when the operation started.

finishedOptional[datetime]

The UTC date and time when the operation finished.

progressOptional[int]

The operation progress as a percentage.

detailsOptional[Any]

Details of the operation completion.

Methods summary

MethodDescription
is_completedChecks whether the operation is completed either successfully or not.
raise_on_failRaises the FailedOperation exception if the operation status is FAIL. Otherwise does nothing.

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