dragon.utils

Functions

b64decode(the_str)

b64encode(the_bytes)

get_hugepage_mount()

get_local_kv(key[, timeout])

get_local_rt_uid()

hash(byte_str)

host_id()

host_id_from_k8s(pod_uid)

This is used to get a hostid based on the k8s pod uid.

set_host_id(new_id)

set_local_kv(key, value[, timeout])

set_procname(name)

Classes

B64

Cython wrapper for Dragon's byte <> string conversion routines.

class B64

Bases: object

Cython wrapper for Dragon’s byte <> string conversion routines.

__init__()

Convert a bytes array into a base64 encoded string. :param data: The list of bytes to convert. :return: A new B64String object containing the base64 encoded string.

classmethod bytes_to_str(the_bytes)

Converts bytes into a string by base64 encoding it. Convenience function to convert bytes objects to base64 encoded strings. :param the_bytes: bytes to get encoded :return: string

decode()
classmethod from_str(serialized_str)
classmethod str_to_bytes(the_str)

Converts a base64 encoded string to a bytes object. Convenience function to unpack strings. :param the_str: base64 encoded string. :return: original bytes representation.

b64decode(the_str)
b64encode(the_bytes)
get_hugepage_mount()
get_local_kv(key, timeout=None)
get_local_rt_uid()
hash(byte_str: bytes )
host_id()
host_id_from_k8s(pod_uid)

This is used to get a hostid based on the k8s pod uid. It is called when a process in one node needs to know the host_id of another node. It can be called from a node/pod as many times as needed in order to translate a pod uid to a dragon hostid. For example, a backend pod can query the hostids of the other backend pods. For setting/assigning the hostid of the pod itself, each pod needs to call set_host_id().

set_host_id(new_id)
set_local_kv(key, value, timeout=None)
set_procname(name)