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

add filter_warnings

parent 0e355e6d
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
import json
import json
import os.path
import os.path
import subprocess
import subprocess
import warnings


from astropy import time
from astropy import time


@@ -22,6 +23,7 @@ class Pipeline:
            n_jobs_cpu=18,
            n_jobs_cpu=18,
            n_jobs_gpu=9,
            n_jobs_gpu=9,
            device="CPU",
            device="CPU",
            filter_warnings=False,
    ):
    ):
        self.dir_in = dir_in
        self.dir_in = dir_in
        self.dir_out = dir_out
        self.dir_out = dir_out
@@ -54,6 +56,9 @@ class Pipeline:
        self.dfs = DFS(n_try=5)
        self.dfs = DFS(n_try=5)
        self.crds = CRDS()
        self.crds = CRDS()


        if filter_warnings:
            self.filter_warnings()

    def set_test_env(self):
    def set_test_env(self):
        os.environ["CSST_DFS_API_MODE"] = "cluster"
        os.environ["CSST_DFS_API_MODE"] = "cluster"
        os.environ["CSST_DFS_GATEWAY"] = "172.24.27.2:30880"
        os.environ["CSST_DFS_GATEWAY"] = "172.24.27.2:30880"
@@ -71,6 +76,16 @@ class Pipeline:
    def now(self):
    def now(self):
        return time.Time.now().isot
        return time.Time.now().isot


    @staticmethod
    def filter_warnings():
        # Suppress all warnings
        warnings.filterwarnings("ignore")

    @staticmethod
    def reset_warnings(self):
        # Reset warning filters
        warnings.resetwarnings()



class Message:
class Message:
    def __init__(self, file_path=""):
    def __init__(self, file_path=""):