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

read_case: defective exception behaviour #3554

Open
seanpearsonuk opened this issue Dec 5, 2024 · 0 comments
Open

read_case: defective exception behaviour #3554

seanpearsonuk opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working Fluent Possibly requires Fluent code change Settings API

Comments

@seanpearsonuk
Copy link
Collaborator

seanpearsonuk commented Dec 5, 2024

There is an existing PyFluent test, which is test_general_exception_behaviour_in_session() in test_session.py where the failing section is commented out to keep the test passing:

    # Error in server:
    # This appears to be a surface mesh.\nSurface meshes cannot be read under the /file/read-case functionality.
    # with pytest.raises(RuntimeError):
    #     solver.settings.file.read(file_type='case', file_name=mesh_file_2d)

As the comment states, there is an error in the server but there is no exception transmitted.

Following is my interactive trial:

1. Non-existent file:

>>> solver.settings.file.read_case(file_name="no_such_file.cas.h5")
...
RuntimeError: File "no_such_file.cas.h5" not found!
Error Object: #f

It's good that we get a RuntimeError here with the message 'File "no_such_file.cas.h5" not found!'. Note however that the subsequent line 'Error Object: #f' is also part of the exception message, which should not be included (in my opinion).

2. Surface mesh file:

>>> solver.settings.file.read_case(file_name=r"TaskObject3.msh.h5")
>>>

passes without incident, resulting in no exception being transmitted, but there is an error message hidden from PyFluent in the Fluent console:

Error: This appears to be a surface mesh.\nSurface meshes cannot be read under the /file/read-case functionality.
Error Object: #f

An exception should be transmitted.

3. Corrupt file:
Here we just create a pseudo-case file with some random text inside and then try to load it:

>>> solver.settings.file.read_case(file_name="nonsense.cas.h5")
>>>

Similar to the surface mesh file, we get no exception in PyFluent. Fluent, meanwhile, is making a lot of noise:

HDF5-DIAG: Error detected in HDF5 (1.12.2) MPI-process 0:
  #000: H5F.c line 620 in H5Fopen(): unable to open file
    major: File accessibility
    minor: Unable to open file
  #001: H5VLcallback.c line 3502 in H5VL_file_open(): failed to iterate over available VOL connector plugins
    major: Virtual Object Layer
    minor: Iteration failed
  #002: H5PLpath.c line 579 in H5PL__path_table_iterate(): can't iterate over plugins in plugin path '(null)'
    major: Plugin for dynamically loaded library
    minor: Iteration failed
  #003: H5PLpath.c line 713 in H5PL__path_table_iterate_process_path(): can't open directory
    major: Plugin for dynamically loaded library
    minor: Can't open directory or file
  #004: H5VLcallback.c line 3351 in H5VL__file_open(): open failed
    major: Virtual Object Layer
    minor: Can't open object
  #005: H5VLnative_file.c line 97 in H5VL__native_file_open(): unable to open file
    major: File accessibility
    minor: Unable to open file
  #006: H5Fint.c line 1990 in H5F_open(): unable to read superblock
    major: File accessibility
    minor: Read failed
  #007: H5Fsuper.c line 405 in H5F__super_read(): file signature not found
    major: File accessibility
    minor: Not an HDF5 file

Error at Node 0: HDF Error occurred! at IO\Hdf\src\HdfFile_impl.hpp:157 during a call to HDF5 library function H5Fopen

@seanpearsonuk seanpearsonuk added bug Something isn't working Fluent Possibly requires Fluent code change Settings API labels Dec 5, 2024
@seanpearsonuk seanpearsonuk changed the title read_case: no exception received for surface mesh file read_case: defective exception behaviour Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fluent Possibly requires Fluent code change Settings API
Projects
None yet
Development

No branches or pull requests

1 participant