Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed May 27, 2021
1 parent 9e47131 commit 00e4cce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions emmet-builders/emmet/builders/vasp/thermo.py
Expand Up @@ -158,7 +158,7 @@ def process_item(self, item: List[Dict]):
)
return []

return [d.dict() for d in docs]
return jsanitize([d.dict() for d in docs], allow_bson=True)

def update_targets(self, items):
"""
Expand All @@ -169,9 +169,9 @@ def update_targets(self, items):
# flatten out lists
items = list(filter(None, chain.from_iterable(items)))
# Check if already updated this run
items = [i for i in items if i[self.thermo.key] not in self._completed_tasks]
items = [i for i in items if i["material_id"] not in self._completed_tasks]

self._completed_tasks |= {i[self.thermo.key] for i in items}
self._completed_tasks |= {i["material_id"] for i in items}

for item in items:
if isinstance(item["last_updated"], dict):
Expand All @@ -181,7 +181,7 @@ def update_targets(self, items):

if len(items) > 0:
self.logger.info(f"Updating {len(items)} thermo documents")
self.thermo.update(docs=jsanitize(items), key=[self.thermo.key])
self.thermo.update(docs=items, key=["material_id"])
else:
self.logger.info("No items to update")

Expand Down

0 comments on commit 00e4cce

Please sign in to comment.