Skip to content

Commit

Permalink
More robust dataset store
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Feb 7, 2025
1 parent fbc6c00 commit d68df31
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion odds/common/metadata_store/es/es_metadata_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ async def storeDataset(self, dataset: Dataset, ctx: str) -> None:
if k not in ['name', 'data_type']:
props[k] = field.pop(k)
field['props'] = json.dumps(props, ensure_ascii=False)
ret = await client.update(index='datasets', id=id, doc=body, doc_as_upsert=True)
try:
ret = await client.update(index='datasets', id=id, doc=body, doc_as_upsert=True)
except Exception as e:
rts.set(ctx, f'ERROR STORING DATASET {dataset.title} -> {id}: {e!r}', 'error')
json.dump(body, open(f'/srv/.caches/error_{id}.json', 'w'))
raise

async def getDataset(self, datasetId: str) -> Dataset:
async with ESClient() as client:
Expand Down

0 comments on commit d68df31

Please sign in to comment.