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
5c53ab5c
Commit
5c53ab5c
authored
Apr 29, 2024
by
Wei Shoulin
Browse files
add find refs
parent
8cfd792c
Changes
3
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
5c53ab5c
...
@@ -31,7 +31,14 @@ class CatalogApi(object):
...
@@ -31,7 +31,14 @@ class CatalogApi(object):
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
datas
.
flush
()
datas
.
flush
()
records
=
pickle
.
loads
(
datas
.
getvalue
())
records
=
pickle
.
loads
(
datas
.
getvalue
())
records
,
cols
=
records
[
0
],
records
[
1
]
columns
=
[]
for
col
in
cols
:
if
col
in
columns
:
columns
.
append
(
"%s_1"
%
(
col
,
))
else
:
columns
.
append
(
col
)
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
).
append
(
"columns"
,
kwargs
[
'
columns
'
]
)
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
).
append
(
"columns"
,
columns
)
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
()))
csst_dfs_api_cluster/common/utils.py
View file @
5c53ab5c
...
@@ -114,8 +114,15 @@ def find_req(function, kwargs):
...
@@ -114,8 +114,15 @@ def find_req(function, kwargs):
else
:
else
:
records
=
pickle
.
loads
(
datas
.
getvalue
())
records
=
pickle
.
loads
(
datas
.
getvalue
())
records
,
cols
=
records
[
0
],
records
[
1
]
records
,
cols
=
records
[
0
],
records
[
1
]
columns
=
[]
for
col
in
cols
:
if
col
in
columns
:
columns
.
append
(
"%s_1"
%
(
col
,
))
else
:
columns
.
append
(
col
)
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
)
\
return
Result
.
ok_data
(
data
=
records
).
append
(
"totalCount"
,
totalCount
)
\
.
append
(
"columns"
,
cols
)
.
append
(
"columns"
,
col
umn
s
)
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
()))
...
...
csst_dfs_api_cluster/facility/level1.py
View file @
5c53ab5c
...
@@ -16,7 +16,13 @@ class Level1DataApi(object):
...
@@ -16,7 +16,13 @@ class Level1DataApi(object):
if
not
isinstance
(
get_parameter
(
kwargs
,
"brick_ids"
),
list
):
if
not
isinstance
(
get_parameter
(
kwargs
,
"brick_ids"
),
list
):
return
Result
.
error
(
message
=
"brick_ids is not a list"
)
return
Result
.
error
(
message
=
"brick_ids is not a list"
)
return
find_req
(
"Level1Servicer.FindByBrickIds"
,
kwargs
)
return
find_req
(
"Level1Servicer.FindByBrickIds"
,
kwargs
)
@
grpc_channel
def
find_refs_by_ids
(
self
,
**
kwargs
):
if
not
isinstance
(
get_parameter
(
kwargs
,
"ids"
),
list
):
return
Result
.
error
(
message
=
"ids is not a list"
)
return
find_req
(
"Level1Servicer.FindRefsByIds"
,
kwargs
)
@
grpc_channel
@
grpc_channel
def
find_by_ids
(
self
,
**
kwargs
):
def
find_by_ids
(
self
,
**
kwargs
):
if
not
isinstance
(
get_parameter
(
kwargs
,
"ids"
),
list
):
if
not
isinstance
(
get_parameter
(
kwargs
,
"ids"
),
list
):
...
...
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