MCPcopy Create free account
hub / github.com/google-research/language / pop_example

Function pop_example

language/realm/preprocessing.py:108–127  ·  view source on GitHub ↗

Pop an example from the given rpc server. This op intentionally fails when the server is unavailable. This is because the RPC op silently fails to recover when the server recovers. Args: address (string): Server created by `push_examples`. timeout_in_ms (in): How long we are willing

(address, timeout_in_ms=10 * 1000 * 60)

Source from the content-addressed store, hash-verified

106
107
108def pop_example(address, timeout_in_ms=10 * 1000 * 60):
109 """Pop an example from the given rpc server.
110
111 This op intentionally fails when the server is unavailable. This is because
112 the RPC op silently fails to recover when the server recovers.
113
114 Args:
115 address (string): Server created by `push_examples`.
116 timeout_in_ms (in): How long we are willing to wait for the next example.
117
118 Returns:
119 response (Tensor<string> []): Serialized tf.Example.
120 """
121 result = _make_rpc_op(address, timeout_in_ms)
122 assert_ok = tf.assert_equal(
123 x=result.status_code,
124 y=tf.errors.OK,
125 data=["RPC call failed", result.status_message])
126 with tf.control_dependencies([assert_ok]):
127 return tf.identity(result.response)
128
129
130def dataset_from_preprocessors(preprocessing_servers,

Callers

nothing calls this directly

Calls 1

_make_rpc_opFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…