"git@csst-tb.bao.ac.cn:csst-cicd/csst-dag.git" did not exist on "ddc681d600b39a2ede6a61485949a11e24e2cd87"
msc.py 1.83 KB
Newer Older
BO ZHANG's avatar
tweaks    
BO ZHANG committed
1
2
import json
from ._base_dag import BaseDAG
BO ZHANG's avatar
tweaks  
BO ZHANG committed
3
4
5
6
from csst_dfs_client import plan, level0

__all__ = ["CsstMscL1Mbi"]

BO ZHANG's avatar
tweaks    
BO ZHANG committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
MSC_MBI_CHIPID = [
    "06",
    "07",
    "08",
    "09",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20",
    "22",
    "23",
    "24",
    "25",
]
BO ZHANG's avatar
tweaks  
BO ZHANG committed
27

BO ZHANG's avatar
tweaks    
BO ZHANG committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
MSC_SLS_CHIPID = [
    "01",
    "02",
    "03",
    "04",
    "05",
    "10",
    "21",
    "26",
    "27",
    "28",
    "29",
    "30",
]


class CsstMscL1Mbi(BaseDAG):
BO ZHANG's avatar
tweaks    
BO ZHANG committed
45
46
    def __init__(self):
        super().__init__("csst-msc-l1-mbi")
BO ZHANG's avatar
tweaks  
BO ZHANG committed
47
48

    def schedule(
BO ZHANG's avatar
tweaks    
BO ZHANG committed
49
        self,
BO ZHANG's avatar
tweaks  
BO ZHANG committed
50
51
52
53
54
55
        dataset: str = "csst-msc-c9-25sqdeg-v3",
        obs_type: str = "WIDE",
        project_id="none",
        batch_id: str | None = "default",
        **kwargs,
    ):
BO ZHANG's avatar
tweaks    
BO ZHANG committed
56
57
58
59
60
61
        # dataset: str = "csst-msc-c9-25sqdeg-v3"
        # obs_type: str = "WIDE"
        # project_id = "none"
        # batch_id: str | None = "default"

        # no need to query plan
BO ZHANG's avatar
tweaks  
BO ZHANG committed
62

BO ZHANG's avatar
tweaks    
BO ZHANG committed
63
64
65
66
67
68
        # plan.find(
        #     instrument="MSC",
        #     dataset=dataset,
        #     obs_type=obs_type,
        #     project_id=project_id,
        # )
BO ZHANG's avatar
tweaks  
BO ZHANG committed
69

BO ZHANG's avatar
tweaks    
BO ZHANG committed
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
        recs = level0.find(
            instrument="MSC",
            dataset=dataset,
            obs_type=obs_type,
            project_id=project_id,
        )
        assert recs.success, recs.message
        msgs = []
        for rec in recs.data:
            msg = self.msg_template.copy()
            msg.update(kwargs)
            msg.update(
                dict(
                    dataset=dataset,
                    obs_type=obs_type,
                    project_id=project_id,
                    batch_id=batch_id,
                    obs_id=rec["obs_id"],
                    chipid=rec["detector_no"],
                    dag_run_id=self.gen_dag_run_id(),
                )
            )
            msgs.append(msg)
        return msgs