Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions azure-kusto-ingest/azure/kusto/ingest/_status_q.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
# Licensed under the MIT License
import random

from typing import List, Callable
from typing import List, Callable, TYPE_CHECKING

from azure.kusto.ingest._resource_manager import _ResourceUri
from azure.storage.queue import QueueServiceClient, QueueClient, QueueMessage, TextBase64EncodePolicy, TextBase64DecodePolicy

if TYPE_CHECKING:
from azure.kusto.ingest.status import StatusMessage


class QueueDetails:
def __init__(self, name, service):
Expand Down Expand Up @@ -34,15 +37,15 @@ def is_empty(self) -> bool:
"""Checks if Status queue has any messages"""
return len(self.peek(1, raw=True)) == 0

def _deserialize_message(self, m: QueueMessage):
def _deserialize_message(self, m: QueueMessage) -> "StatusMessage":
"""Deserialize a message and return at as `message_cls`
:param m: original message m.
"""
return self.message_cls(m.content)

# TODO: current implementation takes a union top n / len(queues), which is not ideal,
# because the user is not supposed to know that there can be multiple underlying queues
def peek(self, n=1, raw=False) -> List[QueueMessage]:
def peek(self, n=1, raw=False) -> List["StatusMessage"]:
"""Peek status queue
:param int n: number of messages to return as part of peek.
:param bool raw: should message content be returned as is (no parsing).
Expand Down Expand Up @@ -87,7 +90,7 @@ def _peek_specific_q(_q: QueueClient, _n: int) -> bool:

# TODO: current implementation takes a union top n / len(queues), which is not ideal,
# because the user is not supposed to know that there can be multiple underlying queues
def pop(self, n: int = 1, raw: bool = False, delete: bool = True) -> List[QueueMessage]:
def pop(self, n: int = 1, raw: bool = False, delete: bool = True) -> List["StatusMessage"]:
"""Pop status queue
:param int n: number of messages to return as part of peek.
:param bool raw: should message content be returned as is (no parsing).
Expand Down
Loading