Commit f5d67757 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

refactor Pipeline.info

parent 00950c15
Pipeline #2792 passed with stage
in 0 seconds
...@@ -33,14 +33,16 @@ class Pipeline: ...@@ -33,14 +33,16 @@ class Pipeline:
""" """
CSST pipeline configuration class. CSST pipeline configuration class.
It should be used for every pipeline to initialize environment. It is used for each pipeline to initialize environment.
Parameters Parameters
---------- ----------
dir_input : str dir_input : str
Input path. Input directory.
dir_output : str dir_output : str
Output path. Output directory.
dir_temp : str
Temp directory.
dir_aux : str dir_aux : str
Aux path. Aux path.
dfs_root : str dfs_root : str
...@@ -129,14 +131,15 @@ class Pipeline: ...@@ -129,14 +131,15 @@ class Pipeline:
if filter_warnings: if filter_warnings:
self.filter_warnings() self.filter_warnings()
def inspect(self): def info(self):
"""List environment variables such as `PIPELINE_ID`, etc.""" """List environment variables such as `PIPELINE_ID`, etc."""
print(f"PIPELINE_ID={self.pipeline_id}") print(f"PIPELINE_ID={self.pipeline_id}")
print(f"BUILD={self.build}") print(f"BUILD={self.build}")
print(f"CREATED={self.created}") print(f"CREATED={self.created}")
print(f"VERBOSE={self.verbose}") print(f"VERBOSE={self.verbose}")
def summary(self) -> fits.Header: @property
def info_header(self) -> fits.Header:
"""Summarize pipeline info into a `astropy.io.fits.Header`.""" """Summarize pipeline info into a `astropy.io.fits.Header`."""
h = fits.Header() h = fits.Header()
h.set("PIPELINE_ID", self.pipeline_id, comment="pipeline ID") h.set("PIPELINE_ID", self.pipeline_id, comment="pipeline ID")
...@@ -144,6 +147,10 @@ class Pipeline: ...@@ -144,6 +147,10 @@ class Pipeline:
h.set("CREATED", self.pipeline_id, comment="pipeline build time") 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 summary")
def summarize(self):
"""Summarize this run."""
pass
def clean_output(self): def clean_output(self):
"""Clean output directory.""" """Clean output directory."""
self.clean_directory(self.dir_output) self.clean_directory(self.dir_output)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment