Functions | |
def | _transform (message, transformer, exception_message) |
def | _wait_once (wait_fn, timeout, spin_cb) |
def | decode (b) |
def | deserialize (serialized_message, deserializer) |
def | encode (s) |
def | fully_qualified_method (group, method) |
def | serialize (message, serializer) |
def | validate_port_binding_result (address, port) |
def | wait (wait_fn, wait_complete_fn, timeout=None, spin_cb=None) |
Variables | |
string | _ERROR_MESSAGE_PORT_BINDING_FAILED = 'Failed to bind to address %s; set ' \ |
_LOGGER = logging.getLogger(__name__) | |
dictionary | CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY |
dictionary | CYGRPC_STATUS_CODE_TO_STATUS_CODE |
float | MAXIMUM_WAIT_TIMEOUT = 0.1 |
dictionary | STATUS_CODE_TO_CYGRPC_STATUS_CODE |
|
private |
Definition at line 81 of file grpc/_common.py.
|
private |
Definition at line 105 of file grpc/_common.py.
def grpc._common.decode | ( | b | ) |
Definition at line 75 of file grpc/_common.py.
def grpc._common.deserialize | ( | serialized_message, | |
deserializer | |||
) |
Definition at line 96 of file grpc/_common.py.
def grpc._common.encode | ( | s | ) |
Definition at line 68 of file grpc/_common.py.
def grpc._common.fully_qualified_method | ( | group, | |
method | |||
) |
Definition at line 101 of file grpc/_common.py.
def grpc._common.serialize | ( | message, | |
serializer | |||
) |
Definition at line 92 of file grpc/_common.py.
def grpc._common.validate_port_binding_result | ( | address, | |
port | |||
) |
Validates if the port binding succeed. If the port returned by Core is 0, the binding is failed. However, in that case, the Core API doesn't return a detailed failing reason. The best we can do is raising an exception to prevent further confusion. Args: address: The address string to be bound. port: An int returned by core
Definition at line 152 of file grpc/_common.py.
def grpc._common.wait | ( | wait_fn, | |
wait_complete_fn, | |||
timeout = None , |
|||
spin_cb = None |
|||
) |
Blocks waiting for an event without blocking the thread indefinitely. See https://github.com/grpc/grpc/issues/19464 for full context. CPython's `threading.Event.wait` and `threading.Condition.wait` methods, if invoked without a timeout kwarg, may block the calling thread indefinitely. If the call is made from the main thread, this means that signal handlers may not run for an arbitrarily long period of time. This wrapper calls the supplied wait function with an arbitrary short timeout to ensure that no signal handler has to wait longer than MAXIMUM_WAIT_TIMEOUT before executing. Args: wait_fn: A callable acceptable a single float-valued kwarg named `timeout`. This function is expected to be one of `threading.Event.wait` or `threading.Condition.wait`. wait_complete_fn: A callable taking no arguments and returning a bool. When this function returns true, it indicates that waiting should cease. timeout: An optional float-valued number of seconds after which the wait should cease. spin_cb: An optional Callable taking no arguments and returning nothing. This callback will be called on each iteration of the spin. This may be used for, e.g. work related to forking. Returns: True if a timeout was supplied and it was reached. False otherwise.
Definition at line 111 of file grpc/_common.py.
|
private |
Definition at line 64 of file grpc/_common.py.
|
private |
Definition at line 23 of file grpc/_common.py.
dictionary grpc._common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY |
Definition at line 25 of file grpc/_common.py.
dictionary grpc._common.CYGRPC_STATUS_CODE_TO_STATUS_CODE |
Definition at line 38 of file grpc/_common.py.
float grpc._common.MAXIMUM_WAIT_TIMEOUT = 0.1 |
Definition at line 62 of file grpc/_common.py.
dictionary grpc._common.STATUS_CODE_TO_CYGRPC_STATUS_CODE |
Definition at line 57 of file grpc/_common.py.