Streaming rich function (#8602)

This commit is contained in:
chaokunyang
2020-05-27 18:36:07 +08:00
committed by GitHub
parent bd4fbcd7fc
commit bcdbe2d3d4
20 changed files with 264 additions and 71 deletions
+18
View File
@@ -29,3 +29,21 @@ def test_key_data_stream():
assert key_stream.get_parallelism() == java_stream.get_parallelism()
assert key_stream.get_parallelism() == python_stream.get_parallelism()
ray.shutdown()
def test_stream_config():
ray.init(load_code_from_local=True, include_java=True)
ctx = StreamingContext.Builder().build()
stream = ctx.from_values(1, 2, 3)
stream.with_config("k1", "v1")
print("config", stream.get_config())
assert stream.get_config() == {"k1": "v1"}
stream.with_config(conf={"k2": "v2", "k3": "v3"})
print("config", stream.get_config())
assert stream.get_config() == {"k1": "v1", "k2": "v2", "k3": "v3"}
java_stream = stream.as_java_stream()
java_stream.with_config(conf={"k4": "v4"})
config = java_stream.get_config()
print("config", config)
assert config == {"k1": "v1", "k2": "v2", "k3": "v3", "k4": "v4"}
ray.shutdown()