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

PIS4 driver and removing .clean files #1352

Open
woodsp-ibm opened this issue Mar 24, 2024 · 0 comments
Open

PIS4 driver and removing .clean files #1352

woodsp-ibm opened this issue Mar 24, 2024 · 0 comments

Comments

@woodsp-ibm
Copy link
Member

A recent nightly run failed https://github.com/qiskit-community/qiskit-nature/actions/runs/8398484669/job/23003395683 as follows:

test.second_q.drivers.psi4d.test_driver_methods_psi4.TestDriverMethodsPsi4.test_oh_rohf
---------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/home/runner/work/qiskit-nature/qiskit-nature/test/second_q/drivers/psi4d/test_driver_methods_psi4.py", line 82, in test_oh_rohf
    result = self._run_driver(driver)
             ^^^^^^^^^^^^^^^^^^^^^^^^

      File "/home/runner/work/qiskit-nature/qiskit-nature/test/second_q/drivers/test_driver_methods_gsc.py", line 45, in _run_driver
    problem: BaseProblem = driver.run()
                           ^^^^^^^^^^^^

      File "/home/runner/work/qiskit-nature/qiskit-nature/qiskit_nature/second_q/drivers/psi4d/psi4driver.py", line 176, in run
    os.remove(run_directory + "/" + local_file)

    FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/qiskit-nature/qiskit-nature/psi.3265.clean'

This is the psi4driver cleaning up at the end and it does so in a loop looking for files

run_directory = os.getcwd()
for local_file in os.listdir(run_directory):
if local_file.endswith(".clean"):
os.remove(run_directory + "/" + local_file)

Given it must have found the file my only take on it failing the remove is that the same scratch directory was being used by another psi4 unit test in another process - stestr runs tests across processes. Hence this logic does not really seem safe across processes in that regard. Now it has been like this forever and normal use would be to do a single computation. One could "fix" the failure by doing a try, catch pass around the removed - that does not allieviate any concern that it might be removing a file from another process that is still needed. I think the scratch dir can be set (env var?), so anyone doing this manually, ie trying to do different psi4 drivers in different processes would have a workaround.

Since it failed I noted it here. I don't really see any need for change at this point. We could possibly note this as a behavior of the driver in its docstring, but I doubt anyone in practice would see this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant