Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_wf should help users if they don't know what presets are available #279

Open
mkhorton opened this issue Mar 26, 2019 · 2 comments
Open
Labels
improvement reported issues that considered further improvement to atomate

Comments

@mkhorton
Copy link
Contributor

In particular, here:

d = loadfn(os.path.join(module_dir, "library", wf_filename))

Something like:

if os.path.isfile(os.path.join(module_dir, "library", wf_filename)):
    d = loadfn(os.path.join(module_dir, "library", wf_filename))
else:
    library_options = glob(os.path.join(module_dir, "library", "*.yaml"))
    raise ValueError(f"Preset does not exist in library, please choose from: {library_options}")
@mkhorton mkhorton changed the title get_wf should have an associated utility method to list presets available get_wf should help users if they don't know what presets are available Mar 26, 2019
@mkhorton
Copy link
Contributor Author

This really needs more work besides anyway as part of a broader clean up, including what common params are, how one are meant to use them, etc. (I know the answer to this, but I suspect the current docstring common_params: (dict) set common params might be insufficient for new users).

@shyuep
Copy link
Collaborator

shyuep commented Mar 26, 2019

I would suggest a simple factory:

class WFFactory:
    names = set(glob.glob(module_dir / "*.yaml"))
    @classmethod
    def get_wf(cls, name):
       if name not in cls.names:
            raise some error.
        ....

@itsduowang itsduowang added enhancement improvement reported issues that considered further improvement to atomate and removed enhancement labels Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement reported issues that considered further improvement to atomate
Projects
None yet
Development

No branches or pull requests

3 participants