materialsproject / jobflow

jobflow is a library for writing computational workflows.
https://materialsproject.github.io/jobflow
Other
93 stars 24 forks source link

An error #448

Closed JohnFengg closed 11 months ago

JohnFengg commented 11 months ago

Discussed in https://github.com/materialsproject/jobflow/discussions/447

Originally posted by **JohnFengg** October 9, 2023 I'm trying to using QUACC package with JOBFLOW wf engine to run a job, my script is like this (regradless of the bug in scripts): ``` from ase.db import connect from quacc.recipes.vasp.mp import mp_relax_flow from quacc.wflow.db import results_to_db database_path = 'perovskites.db' db = connect(database_path) batch_size = 1 #number of structure calculated simultaneously for i in range(0, 1, batch_size): structures = db[i:i + batch_size] flow=mp_relax_flow() #pre_relax={atoms=structures, preset="MPScanSet", calc_swaps= None, copy_files=None} results = flow( structures, prerelax_job_kwargs=None, relax_job_kwargs=None, ) db.close() ``` when I run the scripts, there is an error: > Traceback (most recent call last): > File "/home/toussaint/high-throughput/model-run.py", line 3, in > from quacc.recipes.vasp.mp import mp_relax_flow > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/site-packages/quacc/__init__.py", line 11, in > from quacc.settings import QuaccSettings > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/site-packages/quacc/settings.py", line 20, in > import_module(wflow_engine) > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/importlib/__init__.py", line 126, in import_module > return _bootstrap._gcd_import(name[level:], package, level) > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/site-packages/jobflow/__init__.py", line 14, in > SETTINGS = JobflowSettings() > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/site-packages/pydantic_settings/main.py", line 71, in __init__ > super().__init__( > File "/home/toussaint/opt/miniconda3/envs/quacc/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__ > __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) > pydantic_core._pydantic_core.ValidationError: 2 validation errors for JobflowSettings > JOB_STORE > Value error, Must provide JobStore, the as_dict form, or the proper [type=value_error, input_value=None, input_type=NoneType] > For further information visit https://errors.pydantic.dev/2.4/v/value_error > docs_store > Extra inputs are not permitted [type=extra_forbidden, input_value={'type': 'MongoStore', 'h...'password': 'toussaint'}, input_type=CommentedMap] > For further information visit https://errors.pydantic.dev/2.4/v/extra_forbidden I have created a jobflow.yaml file and export the path in ~/.bashrc, and it seems like there are no error about the yaml files: ``` docs_store: type: MongoStore host: localhost port: 27017 database: ase collection_name: ase username: toussaint password: toussaint ``` I dont know how to fix this, could anyone help me for this?
utf commented 11 months ago

@Andrew-S-Rosen is this something to do with pydantic2?

Andrew-S-Rosen commented 11 months ago

@utf: I think it's because @JohnFengg didn't include two spaces before docs_store (already discussed in https://github.com/Quantum-Accelerators/quacc/discussions/1038).

@JohnFengg: If the issue persists, it would be helpful to share a minimal example. Since this issue is very likely solely related to Jobflow, confirm that the error persists if you just do import jobflow. If so, please share your version number for Jobflow and your YAML (with credentials obscured).

JohnFengg commented 11 months ago

Thanks for replying! @utf @Andrew-S-Rosen It turned out that the issue comes from the spaces error in yaml file, and it works now!

utf commented 11 months ago

Thanks @Andrew-S-Rosen