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-cluster
Commits
790d8712
Commit
790d8712
authored
Jun 08, 2021
by
Wei Shoulin
Browse files
write add obs_id
parent
7275127f
Changes
5
Show whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/facility/level0.py
View file @
790d8712
...
...
@@ -30,7 +30,7 @@ class Level0DataApi(object):
'''
try
:
resp
,
_
=
self
.
stub
.
Find
.
with_call
(
level0_pb2
.
FindLevel0DataReq
(
obs_id
=
get_parameter
(
kwargs
,
"obs_id"
),
obs_id
=
get_parameter
(
kwargs
,
"obs_id"
,
0
),
detector_no
=
get_parameter
(
kwargs
,
"detector_no"
),
obs_type
=
get_parameter
(
kwargs
,
"obs_type"
),
exp_time_start
=
get_parameter
(
kwargs
,
"obs_time"
,
[
None
,
None
])[
0
],
...
...
@@ -67,7 +67,7 @@ class Level0DataApi(object):
if
resp
.
record
is
None
or
resp
.
record
.
id
==
0
:
return
Result
.
error
(
message
=
f
"fits_id:
{
fits_id
}
not found"
)
return
Result
.
ok_data
(
data
=
Level0Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level0Record
()
.
from_proto_model
(
resp
.
record
))
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
))
...
...
@@ -144,7 +144,7 @@ class Level0DataApi(object):
try
:
resp
,
_
=
self
.
stub
.
Write
.
with_call
(
req
,
metadata
=
get_auth_headers
())
if
resp
.
success
:
return
Result
.
ok_data
(
data
=
Level0Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level0Record
()
.
from_proto_model
(
resp
.
record
))
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
...
...
csst_dfs_api_cluster/facility/level0prc.py
View file @
790d8712
...
...
@@ -93,7 +93,7 @@ class Level0PrcApi(object):
try
:
resp
,
_
=
self
.
stub
.
Write
.
with_call
(
req
,
metadata
=
get_auth_headers
())
if
resp
.
success
:
return
Result
.
ok_data
(
data
=
Level0PrcRecord
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level0PrcRecord
()
.
from_proto_model
(
resp
.
record
))
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
except
grpc
.
RpcError
as
e
:
...
...
csst_dfs_api_cluster/facility/observation.py
View file @
790d8712
...
...
@@ -67,7 +67,7 @@ class ObservationApi(object):
if
resp
.
observation
is
None
or
resp
.
observation
.
id
==
0
:
return
Result
.
error
(
message
=
f
"obs_id:
{
obs_id
}
not found"
)
return
Result
.
ok_data
(
data
=
Observation
.
from_proto_model
(
resp
.
observation
))
return
Result
.
ok_data
(
data
=
Observation
()
.
from_proto_model
(
resp
.
observation
))
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
))
...
...
@@ -120,6 +120,7 @@ class ObservationApi(object):
''' insert a observational record into database
parameter kwargs:
obs_id = [int]
obs_time = [str]
exp_time = [int]
module_id = [str]
...
...
@@ -130,6 +131,7 @@ class ObservationApi(object):
'''
rec
=
observation_pb2
.
Observation
(
id
=
get_parameter
(
kwargs
,
"obs_id"
,
0
),
obs_time
=
get_parameter
(
kwargs
,
"obs_time"
),
exp_time
=
get_parameter
(
kwargs
,
"exp_time"
),
module_id
=
get_parameter
(
kwargs
,
"module_id"
),
...
...
@@ -141,7 +143,7 @@ class ObservationApi(object):
try
:
resp
,
_
=
self
.
stub
.
Write
.
with_call
(
req
,
metadata
=
get_auth_headers
())
if
resp
.
success
:
return
Result
.
ok_data
(
data
=
Observation
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Observation
()
.
from_proto_model
(
resp
.
record
))
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
...
...
csst_dfs_api_cluster/ifs/level1.py
View file @
790d8712
...
...
@@ -69,7 +69,7 @@ class Level1DataApi(object):
if
resp
.
record
is
None
or
resp
.
record
.
id
==
0
:
return
Result
.
error
(
message
=
f
"id:
{
id
}
not found"
)
return
Result
.
ok_data
(
data
=
Level1Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level1Record
()
.
from_proto_model
(
resp
.
record
))
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
))
...
...
@@ -141,7 +141,7 @@ class Level1DataApi(object):
return csst_dfs_common.models.Result
'''
rec
=
level1_pb2
.
Level1R
ecor
d
(
rec
=
level1_pb2
.
Det
ec
t
or
(
id
=
0
,
raw_id
=
get_parameter
(
kwargs
,
"raw_id"
),
data_type
=
get_parameter
(
kwargs
,
"data_type"
),
...
...
@@ -163,7 +163,7 @@ class Level1DataApi(object):
try
:
resp
,
_
=
self
.
stub
.
Write
.
with_call
(
req
,
metadata
=
get_auth_headers
())
if
resp
.
success
:
return
Result
.
ok_data
(
data
=
Level1Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level1Record
()
.
from_proto_model
(
resp
.
record
))
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
except
grpc
.
RpcError
as
e
:
...
...
csst_dfs_api_cluster/msc/level1.py
View file @
790d8712
...
...
@@ -69,7 +69,7 @@ class Level1DataApi(object):
if
resp
.
record
is
None
or
resp
.
record
.
id
==
0
:
return
Result
.
error
(
message
=
f
"id:
{
id
}
not found"
)
return
Result
.
ok_data
(
data
=
Level1Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level1Record
()
.
from_proto_model
(
resp
.
record
))
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
))
...
...
@@ -157,7 +157,7 @@ class Level1DataApi(object):
try
:
resp
,
_
=
self
.
stub
.
Write
.
with_call
(
req
,
metadata
=
get_auth_headers
())
if
resp
.
success
:
return
Result
.
ok_data
(
data
=
Level1Record
.
from_proto_model
(
resp
.
record
))
return
Result
.
ok_data
(
data
=
Level1Record
()
.
from_proto_model
(
resp
.
record
))
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
except
grpc
.
RpcError
as
e
:
...
...
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