Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-commons
Commits
76fa06a5
Commit
76fa06a5
authored
Jul 27, 2021
by
Wei Shoulin
Browse files
level0_id
parent
7ab9acee
Changes
8
Hide whitespace changes
Inline
Side-by-side
csst_dfs_commons/__init__.py
View file @
76fa06a5
# coding: utf-8
__version_info__
=
(
1
,
0
,
0
)
__version__
=
'.'
.
join
(
map
(
str
,
__version_info__
))
__all__
=
[
'logging'
]
\ No newline at end of file
csst_dfs_commons/convert/date_utils.py
View file @
76fa06a5
...
...
@@ -4,4 +4,7 @@ def format_datetime(dt):
return
dt
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
def
format_date
(
dt
):
return
dt
.
strftime
(
'%Y-%m-%d'
)
\ No newline at end of file
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
csst_dfs_commons/logging/setup.py
View file @
76fa06a5
...
...
@@ -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
()
...
...
csst_dfs_commons/models/__init__.py
View file @
76fa06a5
...
...
@@ -8,7 +8,7 @@ class Result(dict):
@
property
def
success
(
self
):
return
self
[
"code"
]
>
=
0
return
self
[
"code"
]
=
=
0
@
property
def
data
(
self
):
...
...
csst_dfs_commons/models/common.py
View file @
76fa06a5
...
...
@@ -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
):
...
...
csst_dfs_commons/models/facility.py
View file @
76fa06a5
...
...
@@ -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
=
""
...
...
csst_dfs_commons/models/ifs.py
View file @
76fa06a5
...
...
@@ -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
=
""
...
...
csst_dfs_commons/models/msc.py
View file @
76fa06a5
...
...
@@ -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
=
""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment