예제 #1
0
 def __init__(self, dump_path=None, *args, **kwargs):
     super().__init__(*args, **kwargs)
     if dump_path is not None:
         shard_id = getattr(self.runtime_args, 'shard_id', None)
         shard_dump_path = os.path.join(dump_path, f'{shard_id}.json')
         self._docs = DocumentArray.load_json(shard_dump_path)
     else:
         self._docs = DocumentArray()
예제 #2
0
파일: __init__.py 프로젝트: srbhr/jina
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.logger = JinaLogger('CrudIndexer')
     self._docs = DocumentArray()
     self._dump_location = os.path.join(self.metas.workspace, 'docs.json')
     if os.path.exists(self._dump_location):
         self._docs = DocumentArray.load_json(self._dump_location)
         self.logger.info(
             f'Loaded {len(self._docs)} from {self._dump_location}')
     else:
         self.logger.info(f'No data found at {self._dump_location}')