kaskada.utils
Module Contents
Functions
|
Normalize column name by replacing invalid characters with underscore |
|
|
|
All methods calling handleGrpcError do so after detecting a RpcError. Currently |
|
|
|
Unpack a grpc status detail field (which is a 'google.protobuf.Any' type). |
- normalize_col_name(column)[source]
Normalize column name by replacing invalid characters with underscore strips accents and make lowercase
- 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) –
- 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
-
- Raises:
google.protobuf.message.DecodeError: If it can’t deserialize the message object
Is() checks if the Any message represents the given protocol buffer type.