kaskada.utils

Module Contents

Functions

normalize_col_name(column)

Normalize column name by replacing invalid characters with underscore

get_timestamp(time)

handleGrpcError(rpc_error)

All methods calling handleGrpcError do so after detecting a RpcError. Currently

to_uri(file)

unpack_details(grpc_detail)

Unpack a grpc status detail field (which is a 'google.protobuf.Any' type).

handleException(e)

normalize_col_name(column)[source]

Normalize column name by replacing invalid characters with underscore strips accents and make lowercase

Parameters:

column (str) –

Return type:

str

get_timestamp(time)[source]
Parameters:

time (Union[str, datetime.datetime, None]) –

handleGrpcError(rpc_error)[source]

All methods calling handleGrpcError do so after detecting a RpcError. Currently all our grpc calls perform a UnaryUnaryMultiCallable method, docs linked here: https://grpc.github.io/grpc/python/_modules/grpc.html#UnaryUnaryMultiCallable

Calling a UnaryUnaryMultiCallable method results in one of the following:
Returns:

The response value for the RPC.

Raises:

RpcError: Indicating that the RPC terminated with non-OK status. The raised RpcError will also be a grpc.Call for the RPC affording the RPC’s metadata, status code, and details.

Methods on a grpc.Call object include the following. Full docs here: https://grpc.github.io/grpc/python/_modules/grpc.html#Call

code(): The StatusCode value for the RPC. details(): The details string of the RPC.

The grpc_status.rpc_status.from_call(call) method helps extract details objects from grpc.Call objects. Docs here: https://grpc.github.io/grpc/python/_modules/grpc_status/rpc_status.html#from_call

Args:

call: A grpc.Call instance.

Returns:

A google.rpc.status.Status message representing the status of the RPC.

Raises:

ValueError: If the gRPC call’s code or details are inconsistent with the status code and message inside of the google.rpc.status.Status.

Parameters:

rpc_error (grpc.Call) –

to_uri(file)[source]
Parameters:

file (str) –

Return type:

str

unpack_details(grpc_detail)[source]

Unpack a grpc status detail field (which is a ‘google.protobuf.Any’ type). Unpack() checks the descriptor of the passed-in message object against the stored one and returns False if they don’t match and does not attempt any unpacking; True otherwise.

Sources

Is() checks if the Any message represents the given protocol buffer type.

handleException(e)[source]
Parameters:

e (Exception) –