Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.backend.python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.backend.python
Commits
4eb0c5a6
Commit
4eb0c5a6
authored
5 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[execution][messagehandlers] Add handling of remote write sync
parent
f8eabdc4
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!54
Implement loop output
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/backend/python/execution/messagehandlers.py
+16
-7
16 additions, 7 deletions
beat/backend/python/execution/messagehandlers.py
with
16 additions
and
7 deletions
beat/backend/python/execution/messagehandlers.py
+
16
−
7
View file @
4eb0c5a6
...
...
@@ -47,7 +47,6 @@ import logging
import
zmq
import
simplejson
import
requests
import
threading
from
..dataformat
import
DataFormat
...
...
@@ -162,7 +161,7 @@ class MessageHandler(threading.Thread):
self
.
kill_callback
()
self
.
stop
.
set
()
break
except
RuntimeError
as
e
:
except
RuntimeError
:
import
traceback
message
=
traceback
.
format_exc
()
...
...
@@ -173,10 +172,12 @@ class MessageHandler(threading.Thread):
self
.
kill_callback
()
self
.
stop
.
set
()
break
except
:
except
Exception
:
import
traceback
parser
=
lambda
s
:
s
if
len
(
s
)
<
20
else
s
[:
20
]
+
"
...
"
def
parser
(
s
):
return
s
if
len
(
s
)
<
20
else
s
[:
20
]
+
"
...
"
parsed_parts
=
"
"
.
join
([
parser
(
k
)
for
k
in
parts
])
message
=
(
"
A problem occurred while performing command `%s
'
"
...
...
@@ -249,7 +250,7 @@ class MessageHandler(threading.Thread):
try
:
data_source
=
self
.
data_sources
[
name
]
except
:
except
Exception
:
raise
RemoteException
(
"
sys
"
,
"
Unknown input: %s
"
%
name
)
logger
.
debug
(
"
send: %d infos
"
,
len
(
data_source
))
...
...
@@ -275,12 +276,12 @@ class MessageHandler(threading.Thread):
try
:
data_source
=
self
.
data_sources
[
name
]
except
:
except
Exception
:
raise
RemoteException
(
"
sys
"
,
"
Unknown input: %s
"
%
name
)
try
:
index
=
int
(
index
)
except
:
except
Exception
:
raise
RemoteException
(
"
sys
"
,
"
Invalid index: %s
"
%
index
)
(
data
,
start_index
,
end_index
)
=
data_source
[
index
]
...
...
@@ -351,6 +352,7 @@ class LoopMessageHandler(MessageHandler):
)
self
.
callbacks
.
update
({
"
val
"
:
self
.
validate
})
self
.
callbacks
.
update
({
"
wrt
"
:
self
.
write
})
self
.
executor
=
None
def
setup
(
self
,
algorithm
,
prefix
):
...
...
@@ -401,3 +403,10 @@ class LoopMessageHandler(MessageHandler):
self
.
socket
.
send_string
(
"
True
"
if
is_valid
else
"
False
"
,
zmq
.
SNDMORE
)
self
.
socket
.
send
(
data
.
pack
())
def
write
(
self
):
"""
Trigger a write on the output
"""
logger
.
debug
(
"
recv: wrt
"
)
self
.
executor
.
write
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment