BadNoWriteFormatter¶
- class lsst.daf.butler.tests.BadNoWriteFormatter(file_descriptor: FileDescriptor, *, ref: DatasetRef, write_parameters: Mapping[str, Any] | None = None, write_recipes: Mapping[str, Any] | None = None, **kwargs: Any)¶
Bases:
BadWriteFormatterA formatter that always fails without writing anything.
Methods Summary
write_direct(in_memory_dataset, uri[, ...])Serialize and write directly to final location.
Methods Documentation
- write_direct(in_memory_dataset: Any, uri: ResourcePath, cache_manager: AbstractDatastoreCacheManager | None = None) bool¶
Serialize and write directly to final location.
- Parameters:
- in_memory_dataset
object The Dataset to serialize.
- uri
lsst.resources.ResourcePath URI to use when writing the serialized dataset.
- cache_manager
AbstractDatastoreCacheManager A cache manager to use to allow a formatter to cache the written file.
- in_memory_dataset
- Returns:
- written
bool Flag to indicate whether the direct write did happen.
- written
- Raises:
- Exception
Raised if there was a failure from serializing to bytes that was not
FormatterNotImplementedError.
Notes
This method will call
to_bytesto serialize the in-memory dataset and then will call thewritemethod directly.If the dataset should be cached or is local the file will not be written and the method will return
False. This is because local URIs should be written to a temporary file name and then renamed to allow atomic writes. That path is handled bywrite_locally_then_movethroughwrite_local_file) and is preferred over this method being subclassed and the atomic write re-implemented.