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

Add missing init for errors in VASP UnconvergedErrorHandler #315

Merged
merged 3 commits into from Mar 8, 2024

Conversation

esoteric-ephemera
Copy link
Contributor

@esoteric-ephemera esoteric-ephemera commented Feb 23, 2024

In a recent PR (#313) I mistakenly moved the init for errors in custodian.vasp.handlers.UncovergedErrorHandler so that if an error is unfixable, an exception is thrown at when trying to return {"errors": errors, "actions" : None}:

    return {"errors": errors, "actions": None}
                      ^^^^^^
UnboundLocalError: cannot access local variable 'errors' where it is not associated with a value

This PR corrects that initialization and adds a test for uncorrectable, unconverged runs.

Either way, the job would be terminated by custodian, so this isn't an urgent bug. But we want proper tracking of why the job was terminated.

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what's happening with pytest that requires unzipping the test file in 154fb0f?

@esoteric-ephemera
Copy link
Contributor Author

esoteric-ephemera commented Feb 23, 2024

can you explain what's happening with pytest that requires unzipping the test file in 154fb0f?

Not sure - I noticed that if I run one test file specifically, nothing gets unzipped. If I run pytest tests/ while in the head dir, every file gets unzipped. I'm guessing this is why there's currently a vasprun.xml.indirect and vasprun.xml.indirect.gz in the test files dir - probably missed after someone ran all tests

Also makes sense why the tests fail in CI when I used gzipped files - they get unzipped by pytest --cov=custodian --color=yes tests

@janosh
Copy link
Member

janosh commented Feb 25, 2024

they get unzipped by pytest --cov=custodian --color=yes tests

this is bad! test reference files should not be modified in place. they should be copied to a temp dir first. i refactored most of the handler tests at some point to work that way but looks like the rest of the code base still needs a rework

@esoteric-ephemera
Copy link
Contributor Author

A more significant refactor might be needed for the tests, but might that warrant a separate PR?

@janosh
Copy link
Member

janosh commented Feb 27, 2024

Definitely, except I would recommend the minimum changes required to keep the new test file added in this PR compressed

@shyuep shyuep merged commit 9b67478 into materialsproject:master Mar 8, 2024
3 checks passed
@janosh janosh added handler Error handler fix Bug fix vasp Vienna Ab initio Simulation Package labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix handler Error handler vasp Vienna Ab initio Simulation Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants