Skip to content

Commit

Permalink
Merge branch '0.10.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Aug 16, 2021
2 parents bf00049 + 3ff3a56 commit e63cdb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions biothings/hub/dataindex/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def __str__(self):
lines = [
f"<{type(self).__name__}",
f" source='{self.mongo_collection_name}'" if showx else "",
f" dest='{self.es_index_name}'>"
f" dest='{self.es_index_name}'"
f">"
]
return "".join(lines)

Expand Down Expand Up @@ -325,8 +326,9 @@ def index(self, job_manager, **kwargs):
dx = yield from step.execute(job_manager, **kwargs)
dx = IndexerStepResult(dx)
except Exception as exc:
self.logger.exception(str(exc))
step.state.failed(str(exc))
_exc = str(exc)[:500]
self.logger.exception(_exc)
step.state.failed(_exc)
raise exc
else:
merge(x.data, dx.data)
Expand Down
4 changes: 3 additions & 1 deletion biothings/hub/dataindex/indexer_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def __init__(self, client, index_name):
@functools.lru_cache()
def doc_type(self):
if int(self.client.info()['version']['number'].split('.')[0]) < 7:
return next(iter(self.client.indices.get_mapping(self.index_name).keys()))
mappings = self.client.indices.get_mapping(self.index_name)
mappings = mappings[self.index_name]["mappings"]
return next(iter(mappings.keys()))
return None

# --------------------
Expand Down

0 comments on commit e63cdb1

Please sign in to comment.