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
ccfbdd8c
Commit
ccfbdd8c
authored
Jun 27, 2023
by
Wei Shoulin
Browse files
add other data
parent
5d44851f
Changes
3
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api/facility/level1.py
View file @
ccfbdd8c
...
...
@@ -88,7 +88,7 @@ class Level1DataApi(object):
def
write
(
self
,
**
kwargs
):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
level0_id: [str]
data_type : [str]
...
...
csst_dfs_api/facility/otherdata.py
0 → 100644
View file @
ccfbdd8c
from
..common.delegate
import
Delegate
class
OtherDataApi
(
object
):
"""
Other Data Operation Class
"""
def
__init__
(
self
):
self
.
pymodule
=
Delegate
().
load
(
sub_module
=
"facility"
)
self
.
stub
=
getattr
(
self
.
pymodule
,
"OtherDataApi"
)()
def
find
(
self
,
**
kwargs
):
''' retrieve other data records from database
:param kwargs: Parameter dictionary, key items support:
obs_id: [str]
detector_no: [str]
module_id: [str]
data_type: [str]
create_time : (start, end)
filename: [str]
pipeline_id: [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
write
(
self
,
**
kwargs
):
''' insert a other data record into database
:param kwargs: Parameter dictionary, key items support:
obs_id: [str]
detector_no : [str]
module_id : [str]
file_type : [str]
filename : [str]
file_path : [str]
pipeline_id : [str]
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
write
(
**
kwargs
)
tests/facility/test_facility_otherdata.py
0 → 100644
View file @
ccfbdd8c
import
unittest
from
csst_dfs_api.facility.otherdata
import
OtherDataApi
class
OtherDataTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
api
=
OtherDataApi
()
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
module_id
=
'MSC'
,
create_time
=
(
"2023-06-27 11:12:13"
,
"2023-06-27 23:12:13"
))
print
(
'find:'
,
recs
)
def
test_get
(
self
):
rec
=
self
.
api
.
get
(
id
=
1
)
print
(
'get:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
obs_id
=
'10000012001'
,
file_type
=
"sci"
,
module_id
=
"MSC"
,
detector_no
=
"01"
,
filename
=
"CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_20_img_L1.fits"
,
file_path
=
"/opt/temp/csst/CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_20_img_L1.fits"
,
pipeline_id
=
"P1"
)
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