Skip to content

ark_async_request

ArkAsyncRequest

Bases: ABC

Source code in ark_sdk_python/common/ark_async_request.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class ArkAsyncRequest(ABC):
    def __init__(self, client: ArkClient, async_task: ArkAsyncTask, async_request_settings: ArkAsyncRequestSettings):
        self._async_task = async_task
        self._client = client
        self._async_request_settings = async_request_settings
        self._logger = get_logger(self.__class__.__name__)

    @abstractmethod
    def is_finished(self) -> bool:
        """
        Checks whether or not the current async request has finished.

        Returns:
            bool: _description_
        """

    @abstractmethod
    def task_failed(self) -> bool:
        """
        Checks whether or the current async request failed.

        Returns:
            bool: _description_
        """

    @abstractmethod
    def task_timeout(self) -> bool:
        """
        Checks whether or not the current async request has timed out.

        Returns:
            bool: _description_
        """

    @abstractmethod
    def poll(self, timeout_seconds: int, progress_callback: Callable[[ArkAsyncTask, int, ArkAsyncStatus], None]) -> bool:
        """
        Polls the async request until it has completed.
        Progress callbacks can also be used to return the async request's status.

        Args:
            timeout_seconds (int): _description_
            progress_callback (Callable[[ArkAsyncTask, int, ArkAsyncStatus], None]): _description_

        Returns:
            bool: _description_
        """

    @property
    def async_task(self) -> ArkAsyncTask:
        return self._async_task

    @property
    def client(self) -> ArkClient:
        return self._client

is_finished() abstractmethod

Checks whether or not the current async request has finished.

Returns:

Name Type Description
bool bool

description

Source code in ark_sdk_python/common/ark_async_request.py
16
17
18
19
20
21
22
23
@abstractmethod
def is_finished(self) -> bool:
    """
    Checks whether or not the current async request has finished.

    Returns:
        bool: _description_
    """

poll(timeout_seconds, progress_callback) abstractmethod

Polls the async request until it has completed. Progress callbacks can also be used to return the async request's status.

Parameters:

Name Type Description Default
timeout_seconds int

description

required
progress_callback Callable[[ArkAsyncTask, int, ArkAsyncStatus], None]

description

required

Returns:

Name Type Description
bool bool

description

Source code in ark_sdk_python/common/ark_async_request.py
43
44
45
46
47
48
49
50
51
52
53
54
55
@abstractmethod
def poll(self, timeout_seconds: int, progress_callback: Callable[[ArkAsyncTask, int, ArkAsyncStatus], None]) -> bool:
    """
    Polls the async request until it has completed.
    Progress callbacks can also be used to return the async request's status.

    Args:
        timeout_seconds (int): _description_
        progress_callback (Callable[[ArkAsyncTask, int, ArkAsyncStatus], None]): _description_

    Returns:
        bool: _description_
    """

task_failed() abstractmethod

Checks whether or the current async request failed.

Returns:

Name Type Description
bool bool

description

Source code in ark_sdk_python/common/ark_async_request.py
25
26
27
28
29
30
31
32
@abstractmethod
def task_failed(self) -> bool:
    """
    Checks whether or the current async request failed.

    Returns:
        bool: _description_
    """

task_timeout() abstractmethod

Checks whether or not the current async request has timed out.

Returns:

Name Type Description
bool bool

description

Source code in ark_sdk_python/common/ark_async_request.py
34
35
36
37
38
39
40
41
@abstractmethod
def task_timeout(self) -> bool:
    """
    Checks whether or not the current async request has timed out.

    Returns:
        bool: _description_
    """