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
de5cf475
Commit
de5cf475
authored
Dec 29, 2022
by
Wei Shoulin
Browse files
ephem to stream resp
parent
d244700e
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
de5cf475
import
grpc
import
tim
e
from
collections
import
dequ
e
import
logging
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.common
import
from_proto_model_list
,
Gaia3Record
...
...
@@ -27,7 +27,7 @@ class CatalogApi(object):
return: csst_dfs_common.models.Result
'''
try
:
records
=
[]
records
=
deque
(
[]
)
totalCount
=
0
for
resp
in
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
ra
=
ra
,
...
...
@@ -44,7 +44,6 @@ class CatalogApi(object):
totalCount
=
resp
.
totalCount
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
)
return
Result
.
ok_data
(
data
=
list
(
records
)
)
.
append
(
"totalCount"
,
totalCount
)
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
()))
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