コード例 #1
0
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))
コード例 #2
0
ファイル: test_index.py プロジェクト: stephenjaya99/jina
 def test_simple_route(self):
     f = Flow().add(uses='_pass')
     with f:
         f.index(input_fn=random_docs(10))
コード例 #3
0
ファイル: test_index.py プロジェクト: JHP4911/JINA
def test_simple_route():
    f = Flow().add()
    with f:
        f.index(input_fn=random_docs(10))
コード例 #4
0
def test_flow1(no_inspect):
    f = Flow(no_inspect=no_inspect).add()

    with f:
        f.index(docs)
コード例 #5
0
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()
コード例 #6
0
ファイル: test_segmenter.py プロジェクト: sonfire86/jina
 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)
コード例 #7
0
 def test_simple_route(self):
     f = Flow().add(yaml_path='_forward')
     with f:
         f.index(input_fn=random_docs(10), input_type=ClientInputType.PROTOBUF)
コード例 #8
0
ファイル: test_index.py プロジェクト: tchigher/jina
 def test_simple_route(self):
     f = Flow().add(yaml_path='_forward')
     with f:
         f.index(input_fn=random_docs(10), in_proto=True)
コード例 #9
0
def main():
    f = Flow().load_config('flow-index.yml')
    with f:
        f.index(load, batch=1)
コード例 #10
0
 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)
コード例 #11
0
def index_documents():
    f = Flow().load_config(INDEX_FLOW_FILE_PATH)

    with f:
        f.index(input_fn, request_size=REQUEST_SIZE)
コード例 #12
0
 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)
コード例 #13
0
ファイル: app.py プロジェクト: yuanbit/examples
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)
コード例 #14
0
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))
コード例 #15
0
ファイル: test_flow_eval_pod.py プロジェクト: spothound/jina
def test_flow1(inspect):
    f = Flow(inspect=inspect).add()

    with f:
        f.index(docs)
コード例 #16
0
ファイル: test_loadbalance.py プロジェクト: zatcsc/jina
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)
コード例 #17
0
ファイル: test_segmenter.py プロジェクト: sonfire86/jina
 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)
コード例 #18
0
 def test_any_file(self):
     f = Flow().add(yaml_path='- !URI2DataURI | {base64: true}')
     with f:
         f.index(input_fn=input_fn2)
コード例 #19
0
def test_any_file():
    f = Flow().add(uses='- !URI2DataURI | {base64: true}')
    with f:
        f.index(input_fn=input_fn2)