Fix JobStoreDocument attribute access
Summary
Fix the error:
File "/home/atomate2/src/atomate2/cli/dev.py", line 58, in vasp_test_data
if not isinstance(output["output"], TaskDoc):
~~~~~~^^^^^^^^^^
TypeError: 'JobStoreDocument' object is not subscriptable
Codecov Report
Attention: 5 lines in your changes are missing coverage. Please review.
Comparison is base (
e5ab301) 76.32% compared to head (57edfe6) 76.17%.
Additional details and impacted files
@@ Coverage Diff @@
## main #710 +/- ##
==========================================
- Coverage 76.32% 76.17% -0.16%
==========================================
Files 87 87
Lines 7164 7164
Branches 1057 1057
==========================================
- Hits 5468 5457 -11
- Misses 1373 1385 +12
+ Partials 323 322 -1
| Files | Coverage Δ | |
|---|---|---|
| src/atomate2/cli/dev.py | 0.00% <0.00%> (ø) |
I was trying to add a test, and what I was doing is:
- run a vasp calculation
- add the job directory job_2024-02-10-... to the test data folder of atomate2 test
- run
atm dev vasp-test-data dummyto test it
In dev.py, the directory to copy the VASP files is from outputs.json, and it is an absolute path. Because the vasp files are relocated from wherever they are generated to the test data folder, it won't work.
To make it work, we need to update dev.py to accept a new job dir e.g. from cli, not from outputs.json. This can be done by adding an optional switch (e.g. --job_dirs) to atm dev vasp-test-data.
@utf If you think this is a OK, I can add it. Otherwise, this PR is ready for review.
Thanks!