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
90e8faa7
Commit
90e8faa7
authored
Jan 17, 2023
by
Wei Shoulin
Browse files
✖
️ log line
parent
5e0687e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
90e8faa7
import
grpc
import
pickle
from
collections
import
deque
import
logging
import
io
import
time
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.common
import
from_proto_model_list
,
Gaia3Record
from
csst_dfs_proto.common.ephem
import
ephem_pb2
,
ephem_pb2_grpc
from
.service
import
ServiceProxy
...
...
@@ -34,7 +31,6 @@ class CatalogApi(object):
try
:
datas
=
io
.
BytesIO
()
totalCount
=
0
t_start
=
time
.
time
()
resps
=
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
ra
=
ra
,
dec
=
dec
,
...
...
@@ -47,16 +43,12 @@ class CatalogApi(object):
),
metadata
=
get_auth_headers
())
for
resp
in
resps
:
if
resp
.
success
:
# data = from_proto_model_list(Gaia3Record, resp.records)
datas
.
write
(
resp
.
records
)
totalCount
=
resp
.
totalCount
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
datas
.
flush
()
log
.
info
(
"received used: %.6f's"
%
(
time
.
time
()
-
t_start
,))
t_start
=
time
.
time
()
records
=
pickle
.
loads
(
datas
.
getvalue
())
log
.
info
(
"unserialization used: %.6f's"
%
(
time
.
time
()
-
t_start
,))
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
).
append
(
"columns"
,
columns
)
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