Skip to content

Commit

Permalink
Add catch for parsing task documents into empty collections
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmathis committed Jun 28, 2023
1 parent 1cfc36b commit fb47700
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion emmet-cli/emmet/cli/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,12 @@ def parse(task_ids, snl_metas, nproc, store_volumetric_data, runs): # noqa: C90
{"$group": {"_id": None, "num_max": {"$max": "$num_int"}}},
]
result = list(target.collection.aggregate(pipeline))
next_tid = result[0]["num_max"] + 1

if not result:
next_tid = 1000001 # Only occurs when inserting into an empty task collection for testing
else:
next_tid = result[0]["num_max"] + 1

lst = [f"mp-{next_tid + n}" for n in range(nmax)]
task_ids = chunks(lst, chunk_size)

Expand Down

0 comments on commit fb47700

Please sign in to comment.