[Streaming] Streaming Python API (#6755)

This commit is contained in:
chaokunyang
2020-02-25 10:33:33 +08:00
committed by GitHub
parent 2c1f4fd82c
commit 8b6784de06
71 changed files with 2701 additions and 1928 deletions
+22
View File
@@ -0,0 +1,22 @@
from ray.streaming import function
from ray.streaming.runtime import gateway_client
def test_get_simple_function_class():
simple_map_func_class = function._get_simple_function_class(
function.MapFunction)
assert simple_map_func_class is function.SimpleMapFunction
class MapFunc(function.MapFunction):
def map(self, value):
return str(value)
def test_load_function():
# function_bytes, module_name, class_name, function_name,
# function_interface
descriptor_func_bytes = gateway_client.serialize(
[None, __name__, MapFunc.__name__, None, "MapFunction"])
func = function.load_function(descriptor_func_bytes)
assert type(func) is MapFunc