In a use case where an output of a calculation (a GeneralData type of an aiida-workgraph task) is automatically pickled and used as an input by a subsequent calculation, pickle fails to unpickle the pickled output due to a missing readline method on the file handler, which is of type disk-objectstore.utils.PackedObjectReader.
After chatting with @sphuber, it is understood that due to an optimization step by the disk-objectstore, the file handler changed from io.BufferedReader to disk_objectstore.utils.PackedObjectReader. Unfortunately, as I'm unclear as to when this optimization takes place, I am unable to reproduce the issue at the moment, .
In any case, though disk_objectstore.utils.PackedObjectReader implements read, it does not implement readline, both required by pickle for unpickling. As such, pickle fails to unpickle the output.
@sphuber recommends/suggests that disk_objectstore.utils.PackedObjectReader is revisited to ensure it can be treated on an equal footing as an io.BufferedReader.
In a use case where an output of a calculation (a
GeneralDatatype of anaiida-workgraphtask) is automatically pickled and used as an input by a subsequent calculation,picklefails to unpickle the pickled output due to a missingreadlinemethod on the file handler, which is of typedisk-objectstore.utils.PackedObjectReader.After chatting with @sphuber, it is understood that due to an optimization step by the
disk-objectstore, the file handler changed fromio.BufferedReadertodisk_objectstore.utils.PackedObjectReader. Unfortunately, as I'm unclear as to when this optimization takes place, I am unable to reproduce the issue at the moment, .In any case, though
disk_objectstore.utils.PackedObjectReaderimplementsread, it does not implementreadline, both required bypicklefor unpickling. As such,picklefails to unpickle the output.@sphuber recommends/suggests that
disk_objectstore.utils.PackedObjectReaderis revisited to ensure it can be treated on an equal footing as anio.BufferedReader.