diff --git a/csst_common/__init__.py b/csst_common/__init__.py index b0e1644f902ce79344a03173afbfd67eb7aa40a1..4f4550ff55b2639f0026acc469dcd116671d4b75 100644 --- a/csst_common/__init__.py +++ b/csst_common/__init__.py @@ -10,11 +10,13 @@ Modified-History: 2023-12-15, Bo Zhang, add module header """ -from .decorator import parameterized_module_decorator from .file import File from .pipeline import Pipeline from .status import CsstResult, CsstStatus from .time import now +from .dfs import DFS +from .ccds import CCDS +from .utils import retry __version__ = "0.0.2" @@ -22,5 +24,4 @@ __all__ = [ "Pipeline", "File", "CsstResult", - "parameterized_module_decorator", ] diff --git a/csst_common/ccds/ccds.py b/csst_common/ccds/ccds.py index bbee3770f9f60befccc7c24a92756c23bf559763..babb091437e29cd86f53dde36bb996e7f1520998 100644 --- a/csst_common/ccds/ccds.py +++ b/csst_common/ccds/ccds.py @@ -97,29 +97,6 @@ class CCDS: # 'ledflat': '/ccds_root/references/msc/csst_msc_ms_ledflat_10_000001.fits'} return refs_fp - @staticmethod - def retry(func, n, *args, **kwargs): - for attempt in range(1, n + 1): - try: - res = func(*args, **kwargs) - # assert res["code"] == 0, res - return res - except BaseException as e: - print(f"Error occurs: {e.__repr__()}") - raise RuntimeError(f"All {n} attempts failed.") - - -def retry(func, n=3): - @functools.wraps(func) - def wrapper(*args, **kwargs): - for attempt in range(1, n + 1): - try: - result = func(*args, **kwargs) - return result - except Exception as e: - print(f"尝试 {attempt}/{n} 失败: {e}") - raise RuntimeError("All attempts failed.") - """ file_path="/dfsroot/L0/MSC/SCIE/62030/10160000105/MS/CSST_MSC_MS_SCIE_20280916072059_20280916072329_10160000105_10_L0_V01.fits" diff --git a/csst_common/dfs.py b/csst_common/dfs.py index 6e4e03a697e60b974ad4a574055212dfe6920927..fc7470a24d2af8203331026d6b892ea71f07a1f4 100644 --- a/csst_common/dfs.py +++ b/csst_common/dfs.py @@ -25,16 +25,6 @@ class DFS: def __init__(self, n_try=5): self.n_try = n_try - def retry(self, func, *args, **kwargs): - for attempt in range(self.n_try): - try: - res = func(*args, **kwargs) - assert res["code"] == 0, res - return res - except BaseException as e: - print(f"Error occurs: {e.__repr__()}") - raise RuntimeError("All attempts failed.") - # DFS APIs @property def L0DataApi(self):