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-pipeline
csst_common
Commits
98c50a29
Commit
98c50a29
authored
Jul 11, 2023
by
BO ZHANG
🏀
Browse files
init DFS
parent
b40ae11f
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/dfs.py
View file @
98c50a29
import
os
from
csst_dfs_api.common.catalog
import
CatalogApi
from
csst_dfs_api.facility.level0
import
Level0DataApi
from
csst_dfs_api.facility.level0prc
import
Level0PrcApi
from
csst_dfs_api.facility.level1
import
Level1DataApi
from
csst_dfs_api.facility.level1prc
import
Level1PrcApi
from
csst_dfs_api.facility.otherdata
import
OtherDataApi
from
csst_dfs_api.mbi.level2
import
Level2DataApi
as
MbiLevel2DataApi
from
csst_dfs_api.sls.level2spectra
import
Level2SpectraApi
as
SlsLevel2DataApi
"""
1. DFS 配置
2. 接口retry功能
"""
class
DFS
:
def
__init__
(
self
,
n_try
=
5
):
self
.
n_try
=
n_try
pass
@
staticmethod
def
retry
(
func
,
n
,
*
args
,
**
kwargs
):
for
attempt
in
range
(
1
,
n
+
1
):
def
retry
(
self
,
func
,
*
args
,
**
kwargs
):
for
attempt
in
range
(
self
.
n_try
):
try
:
res
=
func
(
*
args
,
**
kwargs
)
assert
res
[
"code"
]
==
0
,
res
...
...
@@ -17,7 +27,35 @@ class DFS:
print
(
f
"Error occurs:
{
e
.
__repr__
()
}
"
)
raise
RuntimeError
(
"All attempts failed."
)
# DFS APIs
@
property
def
L0DataApi
(
self
):
return
Level0DataApi
()
@
property
def
L0PrcApi
(
self
):
return
Level0PrcApi
()
@
property
def
L1DataApi
(
self
):
return
Level1DataApi
()
@
property
def
L1PrcApi
(
self
):
return
Level1PrcApi
()
@
property
def
L2MbiDataApi
(
self
):
return
MbiLevel2DataApi
()
@
property
def
L2SlsDataApi
(
self
):
return
SlsLevel2DataApi
()
@
property
def
OtherDataApi
(
self
):
return
OtherDataApi
()
@
property
def
CatApi
(
self
):
return
CatalogApi
()
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