Пример #1
0
    def test_op_grpc_client(self):
        error_endpoint = '127.0.0.1:80'
        with pytest.raises(Exception):
            identity(error_endpoint)

        op = new_operator_instance(1, "name", "running", "127.0.0.1", "222")
        with pytest.raises(Exception):
            health(op)

        with pytest.raises(Exception):
            execute(op)
Пример #2
0
 def runner(todo_list):
     metadata, vectors = [], []
     urls = [kwargs['url']] if kwargs['url'] else []
     datas = [kwargs['data']] if kwargs['data'] else []
     try:
         for num, i in enumerate(todo_list):
             if num == len(todo_list) - 1:
                 vectors, _ = execute(i, urls=urls, datas=datas)
                 return vectors
             _, metadatas = execute(i, urls=urls, datas=datas)
             urls = [x.url for x in metadatas]
             datas = [x.data for x in metadatas]
         return metadata
     except Exception as e:
         raise RPCExecError("Execute with error", e)
Пример #3
0
 def runner(todo_list):
     metadata, vectors = [], []
     urls = [kwargs['url']] if kwargs['url'] else []
     datas = [kwargs['data']] if kwargs['data'] else []
     try:
         for i in todo_list:
             if i.type == "processor":
                 _, metadatas = execute(i, urls=urls, datas=datas)
                 urls = [x.url for x in metadatas]
                 datas = [x.data for x in metadatas]
             if i.type == "encoder":
                 vectors, _ = execute(i, urls=urls, datas=datas)
                 return vectors
         return metadata
     except Exception as e:
         raise RPCExecError("Execute with error", e)