qat.pipelines.updateable module

class PipelineConfig(**data)

Bases: BaseModel

Base class for configuring updateable pipelines. Subclasses of UpdateablePipeline should be paried with their own configuration class which specifies custom configuration parameters, and/or sets custom defaults.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
class UpdateablePipeline(config, model=None, loader=None, target_data=None, engine=None)

Bases: AbstractPipeline

A factory for creating and updating pipelines.

Pipelines are designed to be immutable to maintain performance and prevent errors from moving parts. UpdateablePipeline provide a mechanism to update and refresh pipelines with updated components, such as an updated hardware model, without invalidating other components in the pipeline by reconstructing the entire pipeline. It will also inherit the properties and methods of the pipeline it creates, allowing it to be used as a drop-in replacement for the original pipeline.

UpdateablePipeline can be instantiated with either a hardware model or a loader, or both. If both are provided, the model will take precedence for the initial pipeline constuction, but the loader can be used to refresh the model later on. If a loader is provided but not a model, the loader will be used to load the model during the initial pipeline construction.

Parameters:
  • config (PipelineConfig) – The pipeline configuration with the name of the pipeline, and any additional parameters that can be configured in the pipeline.

  • model (Union[None, QuantumHardwareModel, PhysicalHardwareModel]) – The hardware model to feed into the pipeline. Defaults to None.

  • loader (Optional[BaseModelLoader]) – The hardware loader used to load the hardware model which can be used to later refresh the hardware model. Defaults to None.

  • target_data (Optional[TargetData]) – The data concerning the target device, defaults to None

  • engine (Optional[NativeEngine]) – The engine to use for the pipeline, defaults to None.

Raises:

ValueError – If neither model nor loader is provided.

property config: PipelineConfig

Return the pipeline configuration.

classmethod config_type()

Inspects the type of the config attribute in _build_pipeline().

Return type:

type

copy()

Create a copy of the pipeline factory.

Return type:

UpdateablePipeline

copy_with(config=None, model=None, loader=None, target_data=None, engine=None, reload_model=False)

Create a copy of the pipeline factory with updated parameters.

Return type:

UpdateablePipeline

property has_loader: bool

Check if the pipeline has a loader.

is_subtype_of(cls)

Matches the type against the pipeline produced by the factory.

property model: QuantumHardwareModel | PhysicalHardwareModel

Return the model associated with the pipeline.

property name: str

Return the name of the pipeline.

property pipeline: BasePipeline

Return the pipeline instance.

property target_data: TargetData | None

Return the target data associated with the pipeline.

update(config=None, model=None, loader=None, target_data=None, engine=None, reload_model=False)

Update the pipeline configuration and rebuild the pipeline with updated arguments. The whole pipeline is reinstantiated to avoid conflicts with changing components.