Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
csst
Scalebox Apps
Commits
70392fef
Commit
70392fef
authored
Nov 04, 2022
by
zxl
Browse files
Modify message processing logic
parent
3e28918f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
L2/dockerfiles/admL2/admL2.py
L2/dockerfiles/admL2/admL2.py
+21
-8
L2/dockerfiles/admL2/test.py
L2/dockerfiles/admL2/test.py
+0
-7
No files found.
L2/dockerfiles/admL2/admL2.py
View file @
70392fef
...
...
@@ -17,17 +17,19 @@ class admL2Api():
body
=
body
.
split
(
","
,
1
)[
1
]
admL2Api
.
sum_numbers
(
body
,
brickid
)
@
classmethod
def
sum_numbers
(
self
,
body
,
brickid
):
#取name1,name2,name3中第一个逗号之前字符
name
=
body
.
split
(
","
,
1
)[
0
]
#取name1,name2,name3中第一个逗号之后字符
body
=
body
.
split
(
","
,
1
)[
1
]
#取环境变量中模块id,需预先设定
current_job_id
=
os
.
getenv
(
'CSST_ADML2_JOB_ID'
)
#调用grpc的SendJobMessage
channel
=
grpc
.
insecure_channel
(
os
.
getenv
(
'CSST_PIPELINE_GRPC_SERVER'
))
if
","
in
body
:
#取name1,name2,name3中第一个逗号之前字符
name
=
body
.
split
(
","
,
1
)[
0
]
#取name1,name2,name3中第一个逗号之后字符
body
=
body
.
split
(
","
,
1
)[
1
]
stub
=
control_pb2_grpc
.
ControlServiceStub
(
channel
)
test
=
control_pb2
.
JobKey
()
test
.
builtin_job_id
.
current_job_id
=
int
(
current_job_id
)
...
...
@@ -35,7 +37,18 @@ class admL2Api():
test
.
key_text
=
brickid
+
","
+
body
reflag
=
stub
.
SendJobMessage
(
test
)
print
(
reflag
.
value
)
return
"执行完毕1"
stub
=
control_pb2_grpc
.
ControlServiceStub
(
channel
)
test
=
control_pb2
.
JobKey
()
test
.
builtin_job_id
.
current_job_id
=
int
(
current_job_id
)
test
.
builtin_job_id
.
sink_job_name
=
body
test
.
key_text
=
brickid
reflag
=
stub
.
SendJobMessage
(
test
)
print
(
reflag
.
value
)
return
"执行完毕"
if
__name__
==
'__main__'
:
parameter
=
sys
.
argv
body
=
parameter
[
1
]
...
...
L2/dockerfiles/admL2/test.py
deleted
100644 → 0
View file @
3e28918f
import
os
os
.
environ
[
'CSST_PIPELINE_GRPC_SERVER'
]
=
"10.255.2.11:50051"
os
.
environ
[
'CSST_ADML2_JOB_ID'
]
=
"2"
os
.
environ
[
'current_job_id'
]
=
"1"
from
admL2
import
admL2Api
body
=
"brikd,name1,admL2"
admL2Api
().
sum_all
(
body
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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