openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
138 stars 51 forks source link

Reading an incomplete Series fails #741

Open lucafedeli88 opened 4 years ago

lucafedeli88 commented 4 years ago

Describe the bug I am using WarpX ( https://github.com/ECP-WarpX/WarpX , b4067afbd5f487683d6c0f1e5c8ac835d3373fb6) with openPMD output format (ADIOS2 backend). When I try to read a Series from a simulation which is still running or a Series from an output folder generated by a crashed simulation, reading fails with this error message:

[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
terminate called after throwing an instance of 'std::runtime_error'
  what():  [ADIOS2] Requested attribute (/openPMD) not found in backend.
Aborted (core dumped)

Data can be read only if the last timestep is deleted.

To Reproduce Run a simulation with WarpX using openPMD output format and make it stop prematurely (e.g. by killing it). Then read some data with the following instructions:

import openpmd_api as io 
series = io.Series("diags/sp_bp/simData_%T.bp", io.Access_Type.read_only) 

Software Environment

ax3l commented 4 years ago

Thank you for documenting this @lucafedeli88 !

cc @franzpoeschel As discussed elsewhere in the past, we want to address this generally by introducing an Iteration::close() method to release handles as early as possible. Most workflows will know a definite point in time in which a write will not contribute to an iteration anymore. Do you want to take the lead on that one since it is a cut-topic with staging efforts in #570 or shall I draft an implementation for the current methods?

Independent of that, I will submit a PR that reading of incomplete series does work gracefully by gracefully skipping of such files as I did in https://github.com/openPMD/openPMD-viewer/pull/262

franzpoeschel commented 4 years ago

I already have this functionality on my streaming branch, will separate this into a PR next week @ax3l

ax3l commented 4 years ago

Link: #746 :)