nv_ingest_client.message_clients package#

Subpackages#

Submodules#

nv_ingest_client.message_clients.client_base module#

class nv_ingest_client.message_clients.client_base.MessageBrokerClientBase(
host: str,
port: int,
db: int = 0,
max_retries: int = 0,
max_backoff: int = 32,
connection_timeout: int = 300,
max_pool_size: int = 128,
use_ssl: bool = False,
)[source]#

Bases: ABC

Abstract base class for a messaging client to interface with various messaging systems.

Provides a standard interface for sending and receiving messages with connection management and retry logic.

abstract fetch_message(
job_index: str,
timeout: float = 0,
) Any[source]#

Fetches a message from the specified queue with retries on failure.

Parameters:
  • job_index (str) – The index of the job to fetch the message for.

  • timeout (float) – The timeout in seconds for blocking until a message is available.

Returns:

The fetched message, or None if no message could be fetched.

abstract get_client()[source]#

Returns the client instance, reconnecting if necessary.

Returns:

The client instance.

abstract ping() bool[source]#

Checks if the server is responsive.

Returns:

True if the server responds to a ping, False otherwise.

abstract submit_message(
channel_name: str,
message: str,
for_nv_ingest: bool = False,
) Any[source]#

Submits a message to a specified queue with retries on failure.

Parameters:
  • channel_name (str) – The name of the queue to submit the message to.

  • message (str) – The message to submit.

  • for_nv_ingest (bool) – Whether the message is expected to be consumed by NV Ingest.

Module contents#

class nv_ingest_client.message_clients.MessageBrokerClientBase(
host: str,
port: int,
db: int = 0,
max_retries: int = 0,
max_backoff: int = 32,
connection_timeout: int = 300,
max_pool_size: int = 128,
use_ssl: bool = False,
)[source]#

Bases: ABC

Abstract base class for a messaging client to interface with various messaging systems.

Provides a standard interface for sending and receiving messages with connection management and retry logic.

abstract fetch_message(
job_index: str,
timeout: float = 0,
) Any[source]#

Fetches a message from the specified queue with retries on failure.

Parameters:
  • job_index (str) – The index of the job to fetch the message for.

  • timeout (float) – The timeout in seconds for blocking until a message is available.

Returns:

The fetched message, or None if no message could be fetched.

abstract get_client()[source]#

Returns the client instance, reconnecting if necessary.

Returns:

The client instance.

abstract ping() bool[source]#

Checks if the server is responsive.

Returns:

True if the server responds to a ping, False otherwise.

abstract submit_message(
channel_name: str,
message: str,
for_nv_ingest: bool = False,
) Any[source]#

Submits a message to a specified queue with retries on failure.

Parameters:
  • channel_name (str) – The name of the queue to submit the message to.

  • message (str) – The message to submit.

  • for_nv_ingest (bool) – Whether the message is expected to be consumed by NV Ingest.