Commit 76fa06a5 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

level0_id

parent 7ab9acee
# coding: utf-8
__version_info__ = (1, 0, 0)
__version__ = '.'.join(map(str, __version_info__))
__all__ = ['logging']
\ No newline at end of file
......@@ -5,3 +5,6 @@ def format_datetime(dt):
def format_date(dt):
return dt.strftime('%Y-%m-%d')
def format_sql_datetime(dt):
return str(dt) if isinstance(dt, datetime) else dt
\ No newline at end of file
......@@ -12,11 +12,11 @@ import logging.handlers
def setup_logging():
""" Setup logging configuration """
# Console formatter, mention name
cfmt = logging.Formatter(('%(name)s - %(levelname)s - %(message)s'))
cfmt = logging.Formatter(('%(asctime)s- %(name)s - %(filename)s - %(levelname)s - %(message)s'))
# File formatter, mention time
ffmt = logging.Formatter(('%(asctime)s - %(levelname)s - %(message)s'))
ffmt = logging.Formatter(('%(asctime)s - %(filename)s - %(levelname)s - %(message)s'))
# Console handler
ch = logging.StreamHandler()
......
......@@ -8,7 +8,7 @@ class Result(dict):
@property
def success(self):
return self["code"] >= 0
return self["code"] == 0
@property
def data(self):
......
......@@ -13,7 +13,9 @@ class BaseModel:
return self
def from_proto_model(self, record):
return self.from_dict({r.name:v for r,v in record.ListFields()})
for k in self.__dataclass_fields__.keys():
self.__setattr__(k, record.__getattribute__(k))
return self
@dataclasses.dataclass
class Gaia3Record(BaseModel):
......
......@@ -6,6 +6,7 @@ from .common import BaseModel
@dataclasses.dataclass
class Observation(BaseModel):
id: int = 0
obs_id: str = ""
obs_time: str = ""
exp_time : float = 0
module_id: str=""
......@@ -22,18 +23,19 @@ class Observation(BaseModel):
@dataclasses.dataclass
class Level0PrcRecord(BaseModel):
id: int = 0
level0_id: int = 0
level0_id: str = ""
pipeline_id: str = ""
prc_module: str = ""
params_id: str=""
params_file_path: str=""
prc_status: int = 0
prc_time: str=""
file_path: str=""
result_file_path: str=""
@dataclasses.dataclass
class Level0Record(BaseModel):
id: int = 0
obs_id: int = 0
level0_id: str = ""
obs_id: str = ""
detector_no: str = ""
obs_type: str = ""
obs_time: str=""
......@@ -50,6 +52,7 @@ class Level0Record(BaseModel):
@dataclasses.dataclass
class CalMergeRecord(BaseModel):
id: int = 0
cal_id: str = ""
detector_no: str = ""
ref_type: str = ""
obs_time: str=""
......
......@@ -5,7 +5,7 @@ from .common import BaseModel
@dataclasses.dataclass
class Level1Record(BaseModel):
id: int = 0
raw_id : int = 0
level0_id : str = ""
data_type: str=""
cor_sci_id: int = 0
prc_params: str=""
......
......@@ -5,7 +5,7 @@ from .common import BaseModel
@dataclasses.dataclass
class Level1Record(BaseModel):
id: int = 0
raw_id : int = 0
level0_id : str = ""
data_type: str=""
cor_sci_id: int = 0
prc_params: str=""
......
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