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
560df5a2
Commit
560df5a2
authored
Nov 21, 2022
by
Wei Shoulin
Browse files
timeit
parent
01d770ad
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
560df5a2
import
grpc
import
time
import
logging
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.common
import
from_proto_model_list
,
Gaia3Record
...
...
@@ -7,6 +9,7 @@ from .service import ServiceProxy
from
.constants
import
*
from
.utils
import
get_auth_headers
log
=
logging
.
getLogger
(
'csst'
)
class
CatalogApi
(
object
):
def
__init__
(
self
):
self
.
stub
=
ephem_pb2_grpc
.
EphemSearchSrvStub
(
ServiceProxy
().
channel
())
...
...
@@ -36,6 +39,10 @@ class CatalogApi(object):
),
metadata
=
get_auth_headers
())
if
resp
.
success
:
t_start
=
time
.
time
()
data
=
from_proto_model_list
(
Gaia3Record
,
resp
.
records
)
t_end
=
time
.
time
()
log
.
info
(
"object deserialization used: %.6f's"
%
(
t_end
-
t_start
,))
return
Result
.
ok_data
(
data
=
from_proto_model_list
(
Gaia3Record
,
resp
.
records
)).
append
(
"totalCount"
,
resp
.
totalCount
)
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
...
...
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