Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hidra
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
steinbac
hidra
Commits
d1564b59
Commit
d1564b59
authored
8 years ago
by
Manuela Kuhn
Browse files
Options
Downloads
Patches
Plain Diff
Added term handler to TaskProvider and DataDispatcher
parent
d59209be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sender/DataDispatcher.py
+9
-1
9 additions, 1 deletion
src/sender/DataDispatcher.py
src/sender/TaskProvider.py
+15
-0
15 additions, 0 deletions
src/sender/TaskProvider.py
with
24 additions
and
1 deletion
src/sender/DataDispatcher.py
+
9
−
1
View file @
d1564b59
...
@@ -8,6 +8,7 @@ import logging
...
@@ -8,6 +8,7 @@ import logging
import
traceback
import
traceback
import
cPickle
import
cPickle
import
shutil
import
shutil
import
signal
from
multiprocessing
import
Process
from
multiprocessing
import
Process
try
:
try
:
...
@@ -53,7 +54,9 @@ class DataDispatcher():
...
@@ -53,7 +54,9 @@ class DataDispatcher():
self
.
id
=
id
self
.
id
=
id
self
.
log
=
self
.
__getLogger
(
logQueue
)
self
.
log
=
self
.
__getLogger
(
logQueue
)
self
.
currentPID
=
os
.
getpid
()
signal
.
signal
(
signal
.
SIGTERM
,
self
.
signal_term_handler
)
self
.
currentPID
=
os
.
getpid
()
self
.
log
.
debug
(
"
DataDispatcher-
"
+
str
(
self
.
id
)
+
"
started (PID
"
+
str
(
self
.
currentPID
)
+
"
).
"
)
self
.
log
.
debug
(
"
DataDispatcher-
"
+
str
(
self
.
id
)
+
"
started (PID
"
+
str
(
self
.
currentPID
)
+
"
).
"
)
self
.
controlConId
=
controlConId
self
.
controlConId
=
controlConId
...
@@ -297,6 +300,11 @@ class DataDispatcher():
...
@@ -297,6 +300,11 @@ class DataDispatcher():
self
.
context
=
None
self
.
context
=
None
def
signal_term_handler
(
self
,
signal
,
frame
):
self
.
log
.
debug
(
'
got SIGTERM
'
)
self
.
stop
()
def
__exit__
(
self
):
def
__exit__
(
self
):
self
.
stop
()
self
.
stop
()
...
...
This diff is collapsed.
Click to expand it.
src/sender/TaskProvider.py
+
15
−
0
View file @
d1564b59
...
@@ -7,6 +7,8 @@ import logging
...
@@ -7,6 +7,8 @@ import logging
import
sys
import
sys
import
trace
import
trace
import
cPickle
import
cPickle
import
signal
import
errno
try
:
try
:
BASE_PATH
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)
)))
BASE_PATH
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)
)))
...
@@ -45,6 +47,8 @@ class TaskProvider():
...
@@ -45,6 +47,8 @@ class TaskProvider():
self
.
log
=
self
.
getLogger
(
logQueue
)
self
.
log
=
self
.
getLogger
(
logQueue
)
signal
.
signal
(
signal
.
SIGTERM
,
self
.
signal_term_handler
)
self
.
currentPID
=
os
.
getpid
()
self
.
currentPID
=
os
.
getpid
()
self
.
log
.
debug
(
"
TaskProvider started (PID
"
+
str
(
self
.
currentPID
)
+
"
).
"
)
self
.
log
.
debug
(
"
TaskProvider started (PID
"
+
str
(
self
.
currentPID
)
+
"
).
"
)
...
@@ -158,6 +162,12 @@ class TaskProvider():
...
@@ -158,6 +162,12 @@ class TaskProvider():
workloadList
=
self
.
eventDetector
.
getNewEvent
()
workloadList
=
self
.
eventDetector
.
getNewEvent
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
break
break
except
IOError
as
e
:
if
e
.
errno
==
errno
.
EINTR
:
break
else
:
self
.
log
.
error
(
"
Invalid fileEvent message received.
"
,
exc_info
=
True
)
continue
except
:
except
:
self
.
log
.
error
(
"
Invalid fileEvent message received.
"
,
exc_info
=
True
)
self
.
log
.
error
(
"
Invalid fileEvent message received.
"
,
exc_info
=
True
)
#skip all further instructions and continue with next iteration
#skip all further instructions and continue with next iteration
...
@@ -240,6 +250,11 @@ class TaskProvider():
...
@@ -240,6 +250,11 @@ class TaskProvider():
self
.
context
=
None
self
.
context
=
None
def
signal_term_handler
(
self
,
signal
,
frame
):
self
.
log
.
debug
(
'
got SIGTERM
'
)
self
.
stop
()
def
__exit__
(
self
):
def
__exit__
(
self
):
self
.
stop
()
self
.
stop
()
...
...
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