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
ca921178
Commit
ca921178
authored
Jan 04, 2023
by
Wei Shoulin
Browse files
bytes
parent
ffe0b610
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
ca921178
...
@@ -2,6 +2,9 @@ import grpc
...
@@ -2,6 +2,9 @@ import grpc
import
pickle
import
pickle
from
collections
import
deque
from
collections
import
deque
import
logging
import
logging
import
zlib
import
io
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.common
import
from_proto_model_list
,
Gaia3Record
from
csst_dfs_commons.models.common
import
from_proto_model_list
,
Gaia3Record
...
@@ -28,7 +31,7 @@ class CatalogApi(object):
...
@@ -28,7 +31,7 @@ class CatalogApi(object):
return: csst_dfs_common.models.Result
return: csst_dfs_common.models.Result
'''
'''
try
:
try
:
datas
=
b
''
datas
=
io
.
BytesIO
()
totalCount
=
0
totalCount
=
0
resps
=
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
resps
=
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
...
@@ -43,12 +46,12 @@ class CatalogApi(object):
...
@@ -43,12 +46,12 @@ class CatalogApi(object):
for
resp
in
resps
:
for
resp
in
resps
:
if
resp
.
success
:
if
resp
.
success
:
# data = from_proto_model_list(Gaia3Record, resp.records)
# data = from_proto_model_list(Gaia3Record, resp.records)
datas
=
datas
+
resp
.
records
datas
.
write
(
resp
.
records
)
totalCount
=
resp
.
totalCount
totalCount
=
resp
.
totalCount
else
:
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
datas
.
flush
()
records
=
pickle
.
loads
(
datas
)
records
=
pickle
.
loads
(
zlib
.
decompress
(
datas
.
getvalue
())
)
ret_records2
=
[]
ret_records2
=
[]
for
r
in
records
:
for
r
in
records
:
rec
=
Gaia3Record
()
rec
=
Gaia3Record
()
...
...
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