Skip to content

Commit

Permalink
store material_id as entry_id and task_id in data
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Sep 29, 2020
1 parent 65776de commit 903077d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions emmet-builders/emmet/builders/vasp/materials.py
Expand Up @@ -423,9 +423,12 @@ def _structure_eval(task: Dict):
doc for doc in structure_calcs if doc[self.tasks.key] in rt_tasks
]
if len(relevant_calcs) > 0:
entries[rt] = task_doc_to_entry(
entry_dict = task_doc_to_entry(
sorted(relevant_calcs, key=_structure_eval)[0]
)
entry_dict["data"]["task_id"] = entry_dict["entry_id"]
entry_dict["entry_id"] = material_id
entries[rt] = ComputedEntry.from_dict(entry_dict)

# Warnings
# TODO: What warning should we process?
Expand Down Expand Up @@ -462,7 +465,7 @@ def ID_to_int(s_id: str) -> int:
return None


def task_doc_to_entry(task_doc: Dict) -> ComputedEntry:
def task_doc_to_entry(task_doc: Dict) -> Dict:
""" Turns a Task Doc into a ComputedEntry"""

struc = Structure.from_dict(task_doc["output"]["structure"])
Expand All @@ -481,4 +484,4 @@ def task_doc_to_entry(task_doc: Dict) -> ComputedEntry:
},
}

return ComputedEntry.from_dict(entry_dict)
return entry_dict

0 comments on commit 903077d

Please sign in to comment.