def test_flow_with_one_container_pod(docker_image_built): f = Flow().add(name='dummyEncoder1', uses=f'docker://{img_name}') with f: f.index(inputs=random_docs(10))
def test_simple_route(self): f = Flow().add(uses='_pass') with f: f.index(input_fn=random_docs(10))
def test_simple_route(): f = Flow().add() with f: f.index(input_fn=random_docs(10))
def test_flow1(no_inspect): f = Flow(no_inspect=no_inspect).add() with f: f.index(docs)
def test_any_file(mocker): response_mock = mocker.Mock() f = Flow().add(uses='- !URI2DataURI | {base64: true}') with f: f.index(input_fn=input_fn2, on_done=response_mock) response_mock.assert_called()
def test_dummy_seg_random(self): f = Flow().add(yaml_path='../../yaml/dummy-seg-random.yml') with f: f.index(input_fn=random_docs(10), input_type=ClientInputType.PROTOBUF, output_fn=self.collect_chunk_id)
def test_simple_route(self): f = Flow().add(yaml_path='_forward') with f: f.index(input_fn=random_docs(10), input_type=ClientInputType.PROTOBUF)
def test_simple_route(self): f = Flow().add(yaml_path='_forward') with f: f.index(input_fn=random_docs(10), in_proto=True)
def main(): f = Flow().load_config('flow-index.yml') with f: f.index(load, batch=1)
def test_any_file(self): f = Flow().add(yaml_path='!FilePath2DataURI\nwith: {base64: true}') with f: f.index(input_fn=input_fn2, output_fn=print)
def index_documents(): f = Flow().load_config(INDEX_FLOW_FILE_PATH) with f: f.index(input_fn, request_size=REQUEST_SIZE)
def test_lb(self): f = Flow(runtime='process').add(name='sw', yaml_path='SlowWorker', replicas=10) with f: f.index(input_fn=random_docs(100), batch_size=10)
def plot(req): neighbour1 = vecs[[m.id - 1 for m in req.docs[0].matches], :] neighbour2 = vecs[[ mm.id - 1 for m in req.docs[0].matches for mm in m.matches ]] neighbour3 = vecs[[ mmm.id - 1 for m in req.docs[0].matches for mm in m.matches for mmm in mm.matches ]] fig = plt.figure() ax = fig.add_subplot(111) ax.scatter(vecs[:, 0], vecs[:, 1], alpha=0.5) ax.scatter(neighbour3[:, 0], neighbour3[:, 1], color='yellow', alpha=0.5) ax.scatter(neighbour2[:, 0], neighbour2[:, 1], color='cyan', alpha=0.5) ax.scatter(neighbour1[:, 0], neighbour1[:, 1], color='green', alpha=0.5) ax.scatter(vecs[0][0], vecs[0][1], color='red', alpha=0.5) ax.set_aspect('equal', adjustable='box') ax.legend(['index', 'adjacency=3', 'adjacency=2', 'adjacency=1', 'query'], title='high order matches') plt.show() f = Flow(callback_on_body=True).add(uses='test-adj.yml') with f: f.index(index_docs) with f: f.search([index_docs[0]], output_fn=plot)
def test_compression(compress_algo): print(str(compress_algo)) f = Flow(compress=str(compress_algo)).add(name='DummyEncoder', parallel=2) with f: f.index(random_docs(10))
def test_flow1(inspect): f = Flow(inspect=inspect).add() with f: f.index(docs)
def test_lb(): f = Flow(runtime='process').add(name='sw', uses='SlowWorker', parallel=10) with f: f.index(input_fn=random_docs(100), batch_size=10)
def test_dummy_seg(self): f = Flow().add(yaml_path='DummySegment') with f: f.index(input_fn=random_docs(10), input_type=ClientInputType.PROTOBUF, output_fn=self.get_chunk_id)
def test_any_file(self): f = Flow().add(yaml_path='- !URI2DataURI | {base64: true}') with f: f.index(input_fn=input_fn2)
def test_any_file(): f = Flow().add(uses='- !URI2DataURI | {base64: true}') with f: f.index(input_fn=input_fn2)