Skip to main content

Class GPUdbWorkerList

class gpudb_multihead_io.GPUdbWorkerList(gpudb, ip_regex=None, use_head_node_only=False)[source]

A list of worker URLs to use for multi-head ingest.

Automatically populates the GPUdbWorkerList object with the worker URLs for the GPUdb server to support multi-head ingest. (If the specified GPUdb instance has multi-head ingest disabled, the worker list will have the head node URL only and multi-head ingest will not be used.)

Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; this constructor uses the first IP returned by the server for each worker.

Parameters

gpudb (gpudb.GPUdb) –

The gpudb.GPUdb client handle from which to obtain the worker URLs.

ip_regex (str) –

Optional regular expression used to pick one address per worker rank, where a rank advertises more than one. Matching is anchored at the START and NOT at the end, so a pattern selects every address it is a prefix of: 10.0.0.1 selects 10.0.0.1, 10.0.0.10 and 10.0.0.123 alike. End the pattern with $ to name one address exactly. A rank with no matching address is a hard failure, not a fallback.

use_head_node_only (bool) –

Optional boolean flag indicating that only head node should be used (for whatever reason), instead of the workers utilizing the multi-head feature.

validate_ip_address(ip_address)[source]

Validates the input string as an IP address (accepts IPv4 only).

Parameters

ip_address String that needs to be validated.

Returns: true or false.

get_worker_urls()[source]

Returns the list of URLs for the GPUdb worker ranks.

The list is indexed by worker rank, so that the worker indices produced by the server’s shard routing table line up with it directly. None signifies a rank that has been removed from the cluster – it keeps its slot instead of being dropped, because dropping it would shift every later rank by one and misroute sharded records.

This list is meant to be handed to GPUdbIngestor or RecordRetriever, which understand the placeholder convention; anything that does walk it must skip the None entries rather than assume every element is a live worker.

The list reflects the cluster’s rank layout at the time this worker list was built; re-read it after a topology change rather than caching it.

is_multihead_enabled()[source]

Returns whether multi-head I/O is enabled at the server.

Note that this reports the SERVER’s configuration, not this list’s shape. A list built with use_head_node_only still reports True against a multi-head-enabled server, because the server does offer multi-head; that attribute carries the caller’s own intent, and a consumer routing records must honor both.

get_ip_regex()[source]

Returns the IP regex, if any, used to create the worker list.