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-api
Commits
8a5b10cf
Commit
8a5b10cf
authored
Jul 20, 2023
by
Wei Shoulin
Browse files
hstdm l2
parent
c3648df3
Changes
4
Show whitespace changes
Inline
Side-by-side
csst_dfs_api/facility/level1.py
View file @
8a5b10cf
...
...
@@ -47,7 +47,7 @@ class Level1DataApi(object):
''' retrieve level1 records by internal level1 ids like [1,2,3,4]
:param kwargs: Parameter dictionary, key items support:
brick_
ids: [list]
ids: [list]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
find_by_ids
(
**
kwargs
)
...
...
csst_dfs_api/hstdm/__init__.py
View file @
8a5b10cf
from
.level2
import
Level2DataApi
\ No newline at end of file
csst_dfs_api/hstdm/level2.py
0 → 100644
View file @
8a5b10cf
from
..common.delegate
import
Delegate
class
Level2DataApi
(
object
):
"""
Level1 Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"hstdm"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"Level2DataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve level2 spectra records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
level1_id: [int]
project_id: [int]
file_type: [str]
create_time : (start, end),
qc2_status : [int],
prc_status : [int],
filename: [str]
limit: limits returns the number of records,default 0:no-limit
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
find
(
**
kwargs
)
def
get
(
self
,
**
kwargs
):
''' fetch a record from database
:param kwargs: Parameter dictionary, key items support:
id : [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
get
(
**
kwargs
)
def
update_proc_status
(
self
,
**
kwargs
):
''' update the status of reduction
:param kwargs: Parameter dictionary, key items support:
id = [int],
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_proc_status
(
**
kwargs
)
def
update_qc2_status
(
self
,
**
kwargs
):
''' update the status of QC2
:param kwargs: Parameter dictionary, key items support:
id = [int],
status = [int]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
update_qc2_status
(
**
kwargs
)
def
write
(
self
,
**
kwargs
):
''' insert a level2 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
level1_id: [int]
project_id: [int]
file_type : [str]
filename : [str]
file_path : [str]
prc_status : [int]
prc_time : [str]
pipeline_id : [str]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
tests/hstdm/test_hstdm_level2.py
0 → 100644
View file @
8a5b10cf
import
unittest
from
csst_dfs_api.hstdm
import
Level2DataApi
class
HSTDMLevel2TestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
Level2DataApi
()
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
level1_id
=
1
,
create_time
=
(
"2021-06-01 11:12:13"
,
"2021-06-08 11:12:13"
)
)
print
(
'find:'
,
recs
)
def
test_get
(
self
):
rec
=
self
.
api
.
get
(
id
=
1
)
print
(
'get:'
,
rec
)
def
test_update_proc_status
(
self
):
rec
=
self
.
api
.
update_proc_status
(
id
=
1
,
status
=
4
)
print
(
'update_proc_status:'
,
rec
)
def
test_update_qc2_status
(
self
):
rec
=
self
.
api
.
update_qc2_status
(
id
=
1
,
status
=
7
)
print
(
'update_qc1_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
level1_id
=
2
,
project_id
=
2
,
file_type
=
"SPC"
,
prc_status
=
3
,
prc_time
=
'2021-10-22 11:12:13'
,
filename
=
"MSC_MS_210525120000_100000000_20_cat.fits"
,
file_path
=
"/opt/temp/csst/msc_data/MSC_MS_210525120000_100000000_20_cat.fits"
,
pipeline_id
=
"P2"
)
print
(
'write:'
,
rec
)
\ No newline at end of file
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