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
7492bd69
Commit
7492bd69
authored
Dec 29, 2022
by
Wei Shoulin
Browse files
ephem to stream resp
parent
215638ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
7492bd69
...
@@ -27,8 +27,7 @@ class CatalogApi(object):
...
@@ -27,8 +27,7 @@ class CatalogApi(object):
return: csst_dfs_common.models.Result
return: csst_dfs_common.models.Result
'''
'''
try
:
try
:
t_start
=
time
.
time
()
resps
,
_
=
self
.
stub
.
Gaia3Search
.
with_call
(
ephem_pb2
.
EphemSearchRequest
(
resp
,
_
=
self
.
stub
.
Gaia3Search
.
with_call
(
ephem_pb2
.
EphemSearchRequest
(
ra
=
ra
,
ra
=
ra
,
dec
=
dec
,
dec
=
dec
,
radius
=
radius
,
radius
=
radius
,
...
@@ -37,17 +36,16 @@ class CatalogApi(object):
...
@@ -37,17 +36,16 @@ class CatalogApi(object):
obstime
=
obstime
,
obstime
=
obstime
,
limit
=
limit
limit
=
limit
),
metadata
=
get_auth_headers
())
),
metadata
=
get_auth_headers
())
t_end
=
time
.
time
()
records
=
[]
log
.
info
(
"gaia3_query used: %.6f's"
%
(
t_end
-
t_start
,))
totalCount
=
0
if
resp
.
success
:
for
resp
in
resps
:
t_start
=
time
.
time
()
if
resp
.
success
:
data
=
from_proto_model_list
(
Gaia3Record
,
resp
.
records
)
data
=
from_proto_model_list
(
Gaia3Record
,
resp
.
records
)
t_end
=
time
.
time
()
records
.
extend
(
data
)
# log.info("object deserialization used: %.6f's" %(t_end - t_start,))
totalCount
=
resp
.
totalCount
return
Result
.
ok_data
(
data
=
data
).
append
(
"totalCount"
,
resp
.
totalCount
)
else
:
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
)
except
grpc
.
RpcError
as
e
:
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
()))
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