[Streaming] Union api (#8612)

This commit is contained in:
chaokunyang
2020-06-08 14:28:11 +08:00
committed by GitHub
parent 3ee2e9f7e5
commit d04953ab3c
24 changed files with 579 additions and 45 deletions
+12 -2
View File
@@ -23,6 +23,16 @@ class Function(ABC):
pass
class EmptyFunction(Function):
"""Default function which does nothing"""
def open(self, runtime_context):
pass
def close(self):
pass
class SourceContext(ABC):
"""
Interface that source functions use to emit elements, and possibly
@@ -216,7 +226,7 @@ class SimpleFlatMapFunction(FlatMapFunction):
self.func = func
self.process_func = None
sig = inspect.signature(func)
assert len(sig.parameters) <= 2,\
assert len(sig.parameters) <= 2, \
"func should receive value [, collector] as arguments"
if len(sig.parameters) == 2:
@@ -292,7 +302,7 @@ def load_function(descriptor_func_bytes: bytes):
a streaming function
"""
assert len(descriptor_func_bytes) > 0
function_bytes, module_name, function_name, function_interface\
function_bytes, module_name, function_name, function_interface \
= gateway_client.deserialize(descriptor_func_bytes)
if function_bytes:
return deserialize(function_bytes)