From c7e3e5717311b514dca4c803dc743a3f9289965d Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Sun, 31 Dec 2023 10:18:40 +0800 Subject: [PATCH] set Pipeline.build to int --- csst_common/pipeline.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/csst_common/pipeline.py b/csst_common/pipeline.py index 75b8c95..488084c 100644 --- a/csst_common/pipeline.py +++ b/csst_common/pipeline.py @@ -16,7 +16,7 @@ import os import shutil import traceback import warnings -from typing import Callable, NamedTuple, Optional, Any +from typing import Callable, NamedTuple, Optional, Any, Union from astropy.time import Time, TimeDelta from astropy.io import fits @@ -83,7 +83,7 @@ class Pipeline: # get pipeline information from env vars self.pipeline_id: str = os.getenv("PIPELINE_ID", "-") - self.build: str = os.getenv("BUILD", "-") + self.build: int = int(os.getenv("BUILD", "0")) self.created: str = os.getenv("CREATED", "-") self.verbose: bool = bool(os.getenv("VERBOSE", "")) @@ -123,13 +123,15 @@ class Pipeline: # self.error_trace = ErrorTrace(os.path.join(self.dir_output, "error_trace")) if dfs: - self.dfs = DFS() + self.dfs: Union[DFS | None] = DFS() else: - self.dfs = None + self.dfs: Union[DFS | None] = None if ccds: - self.ccds = CCDS(ccds_root=ccds_root, ccds_cache=ccds_cache) + self.ccds: Union[CCDS | None] = CCDS( + ccds_root=ccds_root, ccds_cache=ccds_cache + ) else: - self.ccds = None + self.ccds: Union[CCDS | None] = None if filter_warnings: self.filter_warnings() @@ -148,7 +150,7 @@ class Pipeline: h.set("PIPELINE_ID", self.pipeline_id, comment="pipeline ID") h.set("BUILD", self.build, comment="pipeline build number") h.set("CREATED", self.pipeline_id, comment="pipeline build time") - return reformat_header(h, strip=False, comment="Pipeline summary") + return reformat_header(h, strip=False, comment="Pipeline info") def summarize(self): """Summarize this run.""" -- GitLab