MultiblockWriter¶
- class lsst.pipe.base.quantum_graph.MultiblockWriter(stream: ~typing.IO[bytes], int_size: int, file_size: int = 0, addresses: dict[uuid.UUID, lsst.pipe.base.quantum_graph._multiblock.Address] = <factory>)¶
- Bases: - object- A helper object for writing multi-block files. - Attributes Summary - Running size of the full file. - Methods Summary - open_in_zip(zf, name, int_size)- Open a writer for a file in a zip archive. - write_bytes(id, data)- Write raw bytes to the multi-block file. - write_model(id, model, compressor)- Write raw bytes to the multi-block file. - Attributes Documentation - Methods Documentation - classmethod open_in_zip(zf: zipfile.ZipFile, name: str, int_size: int) Iterator[MultiblockWriter]¶
- Open a writer for a file in a zip archive. - Parameters:
- zfzipfile.ZipFile
- Zip archive to add the file to. 
- namestr
- Base name for the multi-block file; an extension will be added. 
- int_sizeint
- Number of bytes to use for all integers. 
 
- zf
- Returns:
- writercontextlib.AbstractContextManager[MultiblockWriter]
- Context manager that returns a writer when entered. 
 
- writer
 
 - write_model(id: UUID, model: BaseModel, compressor: Compressor) Address¶
- Write raw bytes to the multi-block file. - Parameters:
- iduuid.UUID
- Unique ID of the object described by this block. 
- modelpydantic.BaseModel
- Model to convert to JSON and compress. 
- compressorCompressor
- Object with a - compressmethod that takes and returns- bytes.
 
- id
- Returns:
- addressAddress
- Address of the bytes just written. 
 
- address