Skip to content

Commit

Permalink
test: fix container pea unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Sep 2, 2020
1 parent 5a16a2e commit 77e1485
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions jina/drivers/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ class BaseRankDriver(BaseExecutableDriver):
"""Drivers inherited from this Driver will bind :meth:`rank` by default """

def __init__(self, executor: str = None, method: str = 'score', *args, **kwargs):
super().__init__(executor, method, *args, traverse_on='matches', **kwargs)
super().__init__(executor, method, *args, **kwargs)
self._is_apply = False


class Chunk2DocRankDriver(BaseRankDriver):
"""Extract matches score from chunks and use the executor to compute the rank and assign the resulting matches to the
level above.
Note that it traverses on ``chunks`` not on ``matches``
Input-Output ::
Input:
document: {granularity: k-1}
Expand All @@ -45,7 +47,7 @@ class Chunk2DocRankDriver(BaseRankDriver):
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
super().__init__(*args, traverse_on='chunks', **kwargs)
self.recursion_order = 'post'

def _apply_all(self, docs: Iterable['jina_pb2.Document'], context_doc: 'jina_pb2.Document', *args, **kwargs):
Expand Down
8 changes: 3 additions & 5 deletions tests/unit/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ def test_container_volume(self):
with f:
f.index(random_docs(10))

# it seems that this takes some time to write?
time.sleep(2)
out_file = 'abc/ext-mwu-encoder.bin'
out_file = 'ext-mwu-encoder.bin'

self.assertTrue(os.path.exists(os.path.join(cur_dir, out_file)))
self.add_tmpfile(out_file, './abc')
self.assertTrue(os.path.exists(os.path.join(os.path.abspath('./abc'), out_file)))
self.add_tmpfile(out_file, os.path.abspath('./abc'))

def test_container_ping(self):
a4 = set_pea_parser().parse_args(['--uses', img_name])
Expand Down

0 comments on commit 77e1485

Please sign in to comment.