facility.py 4.03 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
1
import dataclasses
Wei Shoulin's avatar
Wei Shoulin committed
2
3
from typing import List,Dict
from .common import BaseModel, default_field
Wei Shoulin's avatar
Wei Shoulin committed
4
5
6
7

@dataclasses.dataclass
class Observation(BaseModel):
    id: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
8
    obs_id: str = ""
Wei Shoulin's avatar
Wei Shoulin committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    obs_time: str = ""
    exp_time : float = 0
    module_id: str=""
    obs_type: str=""
    facility_status_id: int = 0
    module_status_id: int = 0
    qc0_status: int = 0
    qc0_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
    import_status: int = 0

@dataclasses.dataclass
class Detector(BaseModel):
    no: str = ""
    detector_name: str = ""
    module_id: str=""
    filter_id: float = 0
    create_time: str=""
    update_time: str=""

Wei Shoulin's avatar
C9    
Wei Shoulin committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@dataclasses.dataclass
class Pipeline(BaseModel):
    pipeline_id: str = ""
    pipeline_name: str = ""
    module_id: str=""
    level: int = 0
    create_time: str=""
    update_time: str=""

@dataclasses.dataclass
class FileType(BaseModel):
    file_type_id: str = ""
    file_type: str = ""
    module_id: str=""
    level: int = 0
    create_time: str=""
    update_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
48
49
50
51
52
53
54

@dataclasses.dataclass
class DetectorStatus(BaseModel):
    id: int = 0
    detector_no: str = ""
    status: str=""
    create_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
55
56
    status_time: str=""

Wei Shoulin's avatar
brick    
Wei Shoulin committed
57
58
@dataclasses.dataclass
class Brick(BaseModel):
Wei Shoulin's avatar
new id    
Wei Shoulin committed
59
    id: int = -1
Wei Shoulin's avatar
brick    
Wei Shoulin committed
60
61
62
63
64
65
    ra: float = 0.0
    dec: float = 0.0
    boundingbox: str=""

@dataclasses.dataclass
class BrickObsStatus(BaseModel):
Wei Shoulin's avatar
new id    
Wei Shoulin committed
66
    brick_id: int = -1
Wei Shoulin's avatar
brick    
Wei Shoulin committed
67
68
69
70
71
72
    band: str=""
    cover_num: int = 0
    update_time: str=""

@dataclasses.dataclass
class BrickLevel1(BaseModel):
Wei Shoulin's avatar
new id    
Wei Shoulin committed
73
    brick_id: int = -1
Wei Shoulin's avatar
brick    
Wei Shoulin committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    level1_id: int = 0
    obs_id: str=""
    module: str=""
    obs_time: str=""

@dataclasses.dataclass
class Level2Producer(BaseModel):
    id: int = 0
    name: str=""
    priority: int = 0
    gitlink: str=""
    paramfiles: str=""
    pre_producers: list = dataclasses.field(default_factory=list)
    create_time: str=""
    update_time: str=""      

@dataclasses.dataclass
class Level2Job(BaseModel):
    id: int = 0
    dag: str=""
    status: int = 0
    create_time: str=""
    update_time: str=""     

@dataclasses.dataclass
class Level2ProducerRuning(BaseModel):
    id: int = 0
    job_id: int = 0
    producer_id: int = 0
Wei Shoulin's avatar
new id    
Wei Shoulin committed
103
    brick_id: int = -1
Wei Shoulin's avatar
brick    
Wei Shoulin committed
104
105
106
107
108
109
    start_time: str=""
    end_time: str=""
    prc_status: int = 0
    prc_result: str=""
    create_time: str=""
    update_time: str=""        
Wei Shoulin's avatar
Wei Shoulin committed
110
111
112
113
114
115
116

@dataclasses.dataclass
class Level0Record(BaseModel):
    id: int = 0
    level0_id: str = ""
    obs_id: str = ""
    detector_no: str = ""
Wei Shoulin's avatar
Wei Shoulin committed
117
    module_id: str = ""
Wei Shoulin's avatar
C9    
Wei Shoulin committed
118
    file_type: str = ""
Wei Shoulin's avatar
Wei Shoulin committed
119
120
121
122
123
124
125
126
127
128
129
130
131
    obs_time: str=""
    exp_time: float = 0
    detector_status_id: int = 0
    filename: str=""
    file_path: str=""
    qc0_status: int = 0
    qc0_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
    header: Dict[str,object] = default_field({})

@dataclasses.dataclass
Wei Shoulin's avatar
Wei Shoulin committed
132
class Level0PrcRecord(BaseModel):
Wei Shoulin's avatar
Wei Shoulin committed
133
    id: int = 0
Wei Shoulin's avatar
C9    
Wei Shoulin committed
134
135
    level0_id: int = ""
    run_id: str = ""
Wei Shoulin's avatar
Wei Shoulin committed
136
137
138
139
    pipeline_id: str = ""
    prc_module: str = ""
    prc_status: int = 0
    prc_time: str=""
Wei Shoulin's avatar
C9    
Wei Shoulin committed
140
    message: str=""
Wei Shoulin's avatar
Wei Shoulin committed
141
142
143
144
145

@dataclasses.dataclass
class Level1Record(BaseModel):
    id: int = 0
    level0_id : str = ""
Wei Shoulin's avatar
C9    
Wei Shoulin committed
146
    file_type: str=""
Wei Shoulin's avatar
Wei Shoulin committed
147
148
149
150
151
    cor_sci_id: int = 0
    module_id: str = ""
    prc_params: str=""
    filter: str=""
    filename : str=""
Wei Shoulin's avatar
Wei Shoulin committed
152
153
154
155
156
157
    file_path: str=""
    qc1_status: int = 0
    qc1_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
158
    pipeline_id: str=""
Wei Shoulin's avatar
Wei Shoulin committed
159
    detector_no: str=""
Wei Shoulin's avatar
Wei Shoulin committed
160
    pmapname: str=""
Wei Shoulin's avatar
Wei Shoulin committed
161
    build: int=0
Wei Shoulin's avatar
Wei Shoulin committed
162
163
164
165
166
167
168
    header: Dict[str,object] = default_field({})
    refs: Dict[str,str] = default_field({})

@dataclasses.dataclass
class Level1PrcRecord(BaseModel):
    id: int = 0
    level1_id: int = 0
Wei Shoulin's avatar
C9    
Wei Shoulin committed
169
    run_id: str = ""
Wei Shoulin's avatar
Wei Shoulin committed
170
171
172
173
    pipeline_id: str = ""
    prc_module: str = ""
    prc_status: int = 0
    prc_time: str=""
Wei Shoulin's avatar
C9    
Wei Shoulin committed
174
    message: str=""
Wei Shoulin's avatar
Wei Shoulin committed
175
176
177
178
179
180
181
182
183
184
185
186

@dataclasses.dataclass
class OtherDataRecord(BaseModel):
    id: int = 0
    obs_id : str = ""
    detector_no: str=""
    module_id: str = ""
    file_type: str=""
    filename : str=""
    file_path: str=""
    create_time: str=""
    pipeline_id: str=""