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.

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[QuantumHardwareModel, PhysicalHardwareModel, None]) – The hardware model to feed into the pipeline, cannot be used simultaneously with loader, 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. Cannot be used simultaneously with the 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, or if both are provided.

property backend: BaseBackend

Return the pipeline instance backend.

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. :rtype: UpdateablePipeline

Warning

This creates a copy of the class which reinstantiates the builder. As such, if the pipeline has a loader, this will force the model to be reloaded.

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

Create a copy of the pipeline factory with updated parameters. :rtype: UpdateablePipeline

Warning

If the pipeline has a loader, this will force the model to be reloaded. Additionally, if a model is provided, but the pipeline was previously using a hardware loader, the loader will not be copied.

property engine: NativeEngine

Return the engine of the pipeline.

property frontend: BaseFrontend

Return the pipeline instance frontend.

property middleend: BaseMiddleend

Return the pipeline instance middleend.

property model: QuantumHardwareModel | PhysicalHardwareModel

Return the model associated with the pipeline.

property name: str

Return the name of the pipeline.

property pipeline: Pipeline

Return the pipeline instance.

property runtime: BaseRuntime

Return the runtime of the pipeline.

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.