lsst-pipe-base 30.0.1rc1__py3-none-any.whl → 30.2025.5100__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. lsst/pipe/base/_instrument.py +20 -31
  2. lsst/pipe/base/_quantumContext.py +3 -3
  3. lsst/pipe/base/_status.py +10 -43
  4. lsst/pipe/base/_task_metadata.py +2 -2
  5. lsst/pipe/base/all_dimensions_quantum_graph_builder.py +3 -8
  6. lsst/pipe/base/automatic_connection_constants.py +1 -20
  7. lsst/pipe/base/cli/cmd/__init__.py +2 -18
  8. lsst/pipe/base/cli/cmd/commands.py +4 -149
  9. lsst/pipe/base/connectionTypes.py +160 -72
  10. lsst/pipe/base/connections.py +9 -6
  11. lsst/pipe/base/execution_reports.py +5 -0
  12. lsst/pipe/base/graph/graph.py +10 -11
  13. lsst/pipe/base/graph/quantumNode.py +4 -4
  14. lsst/pipe/base/graph_walker.py +10 -8
  15. lsst/pipe/base/log_capture.py +80 -40
  16. lsst/pipe/base/mp_graph_executor.py +15 -51
  17. lsst/pipe/base/pipeline.py +6 -5
  18. lsst/pipe/base/pipelineIR.py +8 -2
  19. lsst/pipe/base/pipelineTask.py +7 -5
  20. lsst/pipe/base/pipeline_graph/_dataset_types.py +2 -2
  21. lsst/pipe/base/pipeline_graph/_edges.py +22 -32
  22. lsst/pipe/base/pipeline_graph/_mapping_views.py +7 -4
  23. lsst/pipe/base/pipeline_graph/_pipeline_graph.py +7 -14
  24. lsst/pipe/base/pipeline_graph/expressions.py +2 -2
  25. lsst/pipe/base/pipeline_graph/io.py +10 -7
  26. lsst/pipe/base/pipeline_graph/visualization/_dot.py +12 -13
  27. lsst/pipe/base/pipeline_graph/visualization/_layout.py +18 -16
  28. lsst/pipe/base/pipeline_graph/visualization/_merge.py +7 -4
  29. lsst/pipe/base/pipeline_graph/visualization/_printer.py +10 -10
  30. lsst/pipe/base/pipeline_graph/visualization/_status_annotator.py +0 -7
  31. lsst/pipe/base/prerequisite_helpers.py +1 -2
  32. lsst/pipe/base/quantum_graph/_common.py +20 -19
  33. lsst/pipe/base/quantum_graph/_multiblock.py +31 -37
  34. lsst/pipe/base/quantum_graph/_predicted.py +13 -111
  35. lsst/pipe/base/quantum_graph/_provenance.py +45 -1136
  36. lsst/pipe/base/quantum_graph/aggregator/__init__.py +1 -0
  37. lsst/pipe/base/quantum_graph/aggregator/_communicators.py +289 -204
  38. lsst/pipe/base/quantum_graph/aggregator/_config.py +9 -87
  39. lsst/pipe/base/quantum_graph/aggregator/_ingester.py +12 -13
  40. lsst/pipe/base/quantum_graph/aggregator/_scanner.py +235 -49
  41. lsst/pipe/base/quantum_graph/aggregator/_structs.py +116 -6
  42. lsst/pipe/base/quantum_graph/aggregator/_supervisor.py +39 -29
  43. lsst/pipe/base/quantum_graph/aggregator/_writer.py +351 -34
  44. lsst/pipe/base/quantum_graph/visualization.py +1 -5
  45. lsst/pipe/base/quantum_graph_builder.py +8 -21
  46. lsst/pipe/base/quantum_graph_executor.py +13 -116
  47. lsst/pipe/base/quantum_graph_skeleton.py +29 -31
  48. lsst/pipe/base/quantum_provenance_graph.py +12 -29
  49. lsst/pipe/base/separable_pipeline_executor.py +3 -19
  50. lsst/pipe/base/single_quantum_executor.py +42 -67
  51. lsst/pipe/base/struct.py +0 -4
  52. lsst/pipe/base/testUtils.py +3 -3
  53. lsst/pipe/base/tests/mocks/_storage_class.py +1 -2
  54. lsst/pipe/base/version.py +1 -1
  55. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/METADATA +3 -3
  56. lsst_pipe_base-30.2025.5100.dist-info/RECORD +125 -0
  57. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/WHEEL +1 -1
  58. lsst/pipe/base/log_on_close.py +0 -76
  59. lsst/pipe/base/quantum_graph/aggregator/_workers.py +0 -303
  60. lsst/pipe/base/quantum_graph/formatter.py +0 -171
  61. lsst/pipe/base/quantum_graph/ingest_graph.py +0 -413
  62. lsst_pipe_base-30.0.1rc1.dist-info/RECORD +0 -129
  63. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/entry_points.txt +0 -0
  64. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/licenses/COPYRIGHT +0 -0
  65. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/licenses/LICENSE +0 -0
  66. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/licenses/bsd_license.txt +0 -0
  67. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/licenses/gpl-v3.0.txt +0 -0
  68. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/top_level.txt +0 -0
  69. {lsst_pipe_base-30.0.1rc1.dist-info → lsst_pipe_base-30.2025.5100.dist-info}/zip-safe +0 -0
@@ -49,7 +49,7 @@ import warnings
49
49
  from collections import defaultdict
50
50
  from collections.abc import Iterable, Iterator, Mapping, Sequence
51
51
  from contextlib import AbstractContextManager, contextmanager
52
- from typing import TYPE_CHECKING, Any, cast
52
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
53
53
 
54
54
  import networkx
55
55
  import networkx.algorithms.bipartite
@@ -66,7 +66,6 @@ from lsst.daf.butler import (
66
66
  DimensionDataExtractor,
67
67
  DimensionGroup,
68
68
  DimensionRecordSetDeserializer,
69
- DimensionUniverse,
70
69
  LimitedButler,
71
70
  Quantum,
72
71
  QuantumBackedButler,
@@ -110,14 +109,10 @@ if TYPE_CHECKING:
110
109
  from ..config import PipelineTaskConfig
111
110
  from ..graph import QgraphSummary, QuantumGraph
112
111
 
113
- # Sphinx needs imports for type annotations of base class members.
114
- if "sphinx" in sys.modules:
115
- import zipfile # noqa: F401
116
-
117
- from ._multiblock import AddressReader, Decompressor # noqa: F401
112
+ _LOG = logging.getLogger(__name__)
118
113
 
119
114
 
120
- _LOG = logging.getLogger(__name__)
115
+ _T = TypeVar("_T", bound=pydantic.BaseModel)
121
116
 
122
117
 
123
118
  class _PredictedThinQuantumModelV0(pydantic.BaseModel):
@@ -882,49 +877,6 @@ class PredictedQuantumGraph(BaseQuantumGraph):
882
877
  page_size=page_size,
883
878
  ).assemble()
884
879
 
885
- @classmethod
886
- def make_empty(
887
- cls,
888
- universe: DimensionUniverse,
889
- *,
890
- output_run: str,
891
- inputs: Iterable[str] = (),
892
- output: str | None = None,
893
- add_packages: bool = True,
894
- ) -> PredictedQuantumGraph:
895
- """Make an empty quantum graph with no tasks.
896
-
897
- Parameters
898
- ----------
899
- universe : `lsst.daf.butler.DimensionUniverse`
900
- Definitions for all butler dimensions.
901
- output_run : `str`
902
- Output run collection.
903
- inputs : `~collections.abc.Iterable` [`str`], optional
904
- Iterable of input collection names.
905
- output : `str` or `None`, optional
906
- Output chained collection.
907
- add_packages : `bool`, optional
908
- Whether to add the special init quantum that writes the 'packages'
909
- dataset. The default (`True`) is consistent with
910
- `~..quantum_graph_builder.QuantumGraphBuilder` behavior when there
911
- are no regular quanta generated.
912
-
913
- Returns
914
- -------
915
- quantum_graph : `PredictedQuantumGraph`
916
- An empty quantum graph.
917
- """
918
- return cls(
919
- PredictedQuantumGraphComponents.make_empty(
920
- universe,
921
- output_run=output_run,
922
- inputs=inputs,
923
- output=output,
924
- add_packages=add_packages,
925
- )
926
- )
927
-
928
880
  @property
929
881
  def quanta_by_task(self) -> Mapping[str, Mapping[DataCoordinate, uuid.UUID]]:
930
882
  """A nested mapping of all quanta, keyed first by task name and then by
@@ -1589,63 +1541,6 @@ class PredictedQuantumGraphComponents:
1589
1541
  This does not include special "init" quanta.
1590
1542
  """
1591
1543
 
1592
- @classmethod
1593
- def make_empty(
1594
- cls,
1595
- universe: DimensionUniverse,
1596
- *,
1597
- output_run: str,
1598
- inputs: Iterable[str] = (),
1599
- output: str | None = None,
1600
- add_packages: bool = True,
1601
- ) -> PredictedQuantumGraphComponents:
1602
- """Make components for an empty quantum graph with no tasks.
1603
-
1604
- Parameters
1605
- ----------
1606
- universe : `lsst.daf.butler.DimensionUniverse`
1607
- Definitions for all butler dimensions.
1608
- output_run : `str`
1609
- Output run collection.
1610
- inputs : `~collections.abc.Iterable` [`str`], optional
1611
- Iterable of input collection names.
1612
- output : `str` or `None`, optional
1613
- Output chained collection.
1614
- add_packages : `bool`, optional
1615
- Whether to add the special init quantum that writes the 'packages'
1616
- dataset. The default (`True`) is consistent with
1617
- `~..quantum_graph_builder.QuantumGraphBuilder` behavior when there
1618
- are no regular quanta generated.
1619
-
1620
- Returns
1621
- -------
1622
- components : `PredictedQuantumGraphComponents`
1623
- Components that can be used to build or write an empty quantum
1624
- graph.
1625
- """
1626
- components = cls(pipeline_graph=PipelineGraph(universe=universe))
1627
- components.header.inputs = list(inputs)
1628
- components.header.output_run = output_run
1629
- components.header.output = output
1630
- if add_packages:
1631
- components.init_quanta.root = [
1632
- PredictedQuantumDatasetsModel.model_construct(
1633
- quantum_id=generate_uuidv7(),
1634
- task_label="",
1635
- outputs={
1636
- acc.PACKAGES_INIT_OUTPUT_NAME: [
1637
- PredictedDatasetModel(
1638
- dataset_id=generate_uuidv7(),
1639
- dataset_type_name=acc.PACKAGES_INIT_OUTPUT_NAME,
1640
- data_coordinate=[],
1641
- run=output_run,
1642
- )
1643
- ]
1644
- },
1645
- )
1646
- ]
1647
- return components
1648
-
1649
1544
  def make_dataset_ref(self, predicted: PredictedDatasetModel) -> DatasetRef:
1650
1545
  """Make a `lsst.daf.butler.DatasetRef` from information in the
1651
1546
  predicted quantum graph.
@@ -1898,6 +1793,7 @@ class PredictedQuantumGraphComponents:
1898
1793
  f"Unsupported extension {ext!r} for quantum graph; "
1899
1794
  "expected '.qg' (or '.qgraph' to force the old format)."
1900
1795
  )
1796
+ cdict: zstandard.ZstdCompressionDict | None = None
1901
1797
  cdict_data: bytes | None = None
1902
1798
  quantum_datasets_json: dict[uuid.UUID, bytes] = {}
1903
1799
  if len(self.quantum_datasets) < zstd_dict_n_inputs:
@@ -1911,20 +1807,26 @@ class PredictedQuantumGraphComponents:
1911
1807
  for quantum_model in itertools.islice(self.quantum_datasets.values(), zstd_dict_n_inputs)
1912
1808
  }
1913
1809
  try:
1914
- cdict_data = zstandard.train_dictionary(
1810
+ cdict = zstandard.train_dictionary(
1915
1811
  zstd_dict_size,
1916
1812
  list(quantum_datasets_json.values()),
1917
1813
  level=zstd_level,
1918
- ).as_bytes()
1814
+ )
1919
1815
  except zstandard.ZstdError as err:
1920
1816
  warnings.warn(f"Not using a compression dictionary: {err}.")
1817
+ cdict = None
1818
+ else:
1819
+ cdict_data = cdict.as_bytes()
1820
+ compressor = zstandard.ZstdCompressor(level=zstd_level, dict_data=cdict)
1821
+ indices = {quantum_id: n for n, quantum_id in enumerate(sorted(self.quantum_datasets.keys()))}
1921
1822
  with BaseQuantumGraphWriter.open(
1922
1823
  uri,
1923
1824
  header=self.header,
1924
1825
  pipeline_graph=self.pipeline_graph,
1826
+ indices=indices,
1925
1827
  address_filename="quanta",
1828
+ compressor=compressor,
1926
1829
  cdict_data=cdict_data,
1927
- zstd_level=zstd_level,
1928
1830
  ) as writer:
1929
1831
  writer.write_single_model("thin_graph", self.thin_graph)
1930
1832
  if self.dimension_data is None: