Coverage for python/lsst/pipe/base/graph/graphSummary.py: 100%
30 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 02:43 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 02:43 -0700
1# This file is part of pipe_base.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22import sys
23from collections import Counter
24from typing import Any
26import pydantic
28from .quantumNode import BuildId
30__all__ = ("QgraphSummary", "QgraphTaskSummary")
33class QgraphTaskSummary(pydantic.BaseModel):
34 """Quanta information summarized for single PipelineTask."""
36 taskLabel: str | None = None
37 """PipelineTask label."""
39 numQuanta: int = 0
40 """Number of Quanta for this PipelineTask in this QuantumGraph."""
42 numInputs: dict[str, int] = Counter()
43 """Total number of inputs per dataset type name for this PipelineTask."""
45 numOutputs: dict[str, int] = Counter()
46 """Total number of outputs per dataset type name for this PipelineTask."""
48 # Work around the fact that Sphinx chokes on Pydantic docstring formatting,
49 # when we inherit those docstrings in our public classes.
50 if "sphinx" in sys.modules: # pragma: no cover
52 def copy(self, *args: Any, **kwargs: Any) -> Any:
53 """See `pydantic.BaseModel.copy`."""
54 return super().copy(*args, **kwargs)
56 def model_dump(self, *args: Any, **kwargs: Any) -> Any:
57 """See `pydantic.BaseModel.model_dump`."""
58 return super().model_dump(*args, **kwargs)
60 def model_dump_json(self, *args: Any, **kwargs: Any) -> Any:
61 """See `pydantic.BaseModel.model_dump_json`."""
62 return super().model_dump_json(*args, **kwargs)
64 def model_copy(self, *args: Any, **kwargs: Any) -> Any:
65 """See `pydantic.BaseModel.model_copy`."""
66 return super().model_copy(*args, **kwargs)
68 @classmethod
69 def model_json_schema(cls, *args: Any, **kwargs: Any) -> Any:
70 """See `pydantic.BaseModel.model_json_schema`."""
71 return super().model_json_schema(*args, **kwargs)
74class QgraphSummary(pydantic.BaseModel):
75 """Report for the QuantumGraph creation or reading."""
77 graphID: BuildId
78 """QuantumGraph ID."""
80 cmdLine: str | None = None
81 """Command line for creation of original QuantumGraph."""
83 creationUTC: str | None = None
84 """Time of creation."""
86 inputCollection: list[str] | None = None
87 """Input collection."""
89 outputCollection: str | None = None
90 """Output collection."""
92 outputRun: str | None = None
93 """Output run collection."""
95 qgraphTaskSummaries: dict[str, QgraphTaskSummary] = {}
96 """Quanta information summarized per PipelineTask."""
98 # Work around the fact that Sphinx chokes on Pydantic docstring formatting,
99 # when we inherit those docstrings in our public classes.
100 if "sphinx" in sys.modules: # pragma: no cover
102 def copy(self, *args: Any, **kwargs: Any) -> Any:
103 """See `pydantic.BaseModel.copy`."""
104 return super().copy(*args, **kwargs)
106 def model_dump(self, *args: Any, **kwargs: Any) -> Any:
107 """See `pydantic.BaseModel.model_dump`."""
108 return super().model_dump(*args, **kwargs)
110 def model_dump_json(self, *args: Any, **kwargs: Any) -> Any:
111 """See `pydantic.BaseModel.model_dump_json`."""
112 return super().model_dump_json(*args, **kwargs)
114 def model_copy(self, *args: Any, **kwargs: Any) -> Any:
115 """See `pydantic.BaseModel.model_copy`."""
116 return super().model_copy(*args, **kwargs)
118 @classmethod
119 def model_json_schema(cls, *args: Any, **kwargs: Any) -> Any:
120 """See `pydantic.BaseModel.model_json_schema`."""
121 return super().model_json_schema(*args, **kwargs)