Class RecordRetriever

class gpudb_multihead_io.RecordRetriever(gpudb, table_name, record_type, workers=None, is_table_replicated=False)[source]

Retrieves records from all worker ranks directly. If multi-head retrieval is not set up, then automatically retrieves records from the head node.

Initializes the RecordRetriever instance.

Parameters

gpudb (GPUdb) –
The client handle through which the retrieval process is to be conducted.
table_name (str) –
The name of the table from which records will be fetched. Must be an existing table.
record_type (GPUdbRecordType) –
The type for the records which will be retrieved; must match the type of the given table.
workers (GPUdbWorkerList) –
Optional parameter. A list of GPUdb worker rank addresses.
is_table_replicated (bool) –
Optional boolean flag indicating whether the table is replicated; if True, then multi-head ingestion will not be used (but the head node would be used for ingestion instead). This is due to GPUdb not supporting multi-head retrieval on replicated tables which are un-sharded by design.
set_logger_level(log_level)[source]

Set the log level for the GPUdb multi-head i/o module.

Parameters

log_level (int, long, or str) –
A valid log level for the logging module
get_records_by_key(key_values, expression='', options=None)[source]

Fetches the record(s) from the appropriate worker rank directly (or, if multi-head record retrieval is not set up, then from the head node) that map to the given shard key.

Parameters

key_values (list or dict) –
Values for the sharding columns of the record to fetch either in a list (then it is assumed to be in the order of the sharding keys in the record type) or a dict. Must not have any missing sharding/primary column value or any extra column values.
expression (str) –
Optional parameter. If given, it is passed to /get/records as a filter expression.
options (dict of str to str or None) –
Any /get/records options to be passed onto the GPUdb server. Optional parameter.

Returns

The decoded records.