dcnum.write.chunk_writer

Classes

ChunkWriter

Convenience class for writing to data outside the main loop

Module Contents

class dcnum.write.chunk_writer.ChunkWriter(path_out: pathlib.Path | dcnum.common.h5py.File, dq: collections.deque, write_queue_size: multiprocessing.sharedctypes.Synchronized, ds_kwds: dict | None = None, mode: str = 'a', parent_logger: logging.Logger | None = None, *args, **kwargs)[source]

Bases: threading.Thread

Convenience class for writing to data outside the main loop

Data are numpy arrays collected from a dequeue object

Parameters:
  • path_out – Path to the output HDF5 file

  • dq (collections.deque) – collections.deque object from which data are taken using popleft().

  • write_queue_size – Multiprocessing value to which the size of dq is written periodically

  • ds_kwds – keyword arguments for dataset creation, passed to HDF5Writer

  • mode – HDF5 file opening mode, passed to HDF5Writer

writer
dq
may_stop_loop = False
must_stop_loop = False
write_queue_size
abort_loop()[source]

Force aborting the loop as soon as possible

finished_when_queue_empty()[source]

Stop the loop as soon as self.dq is empty

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.