Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
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.web
Commits
6b91d1b3
Commit
6b91d1b3
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[backend] Also clean-up zombies after each iteration
parent
5a605082
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/web/backend/schedule.py
+9
-0
9 additions, 0 deletions
beat/web/backend/schedule.py
beat/web/backend/views.py
+5
-5
5 additions, 5 deletions
beat/web/backend/views.py
with
14 additions
and
5 deletions
beat/web/backend/schedule.py
+
9
−
0
View file @
6b91d1b3
...
...
@@ -36,6 +36,7 @@ import subprocess
import
logging
logger
=
logging
.
getLogger
(
__name__
)
import
psutil
import
simplejson
from
django.conf
import
settings
...
...
@@ -475,6 +476,14 @@ def work(environments, cpulimit, process, django_settings):
subprocess
.
Popen
(
cmdline
+
[
execute
,
str
(
j
.
pk
)])
def
cleanup_zombies
():
'''
Cleans-up eventual zombie subprocesses launched by the call above
'''
for
child
in
psutil
.
Process
().
children
():
if
child
.
status
==
psutil
.
STATUS_ZOMBIE
:
child
.
wait
()
def
resolve_process_path
():
'''
Returns the path to cpulimit
'''
...
...
This diff is collapsed.
Click to expand it.
beat/web/backend/views.py
+
5
−
5
View file @
6b91d1b3
...
...
@@ -46,7 +46,7 @@ from beat.core.async import resolve_cpulimit_path
from
.models
import
Environment
,
Worker
,
Queue
from
..experiments.models
import
Experiment
from
.
import
state
from
.schedule
import
schedule
,
work
,
worker_update
from
.schedule
import
schedule
,
work
,
worker_update
,
cleanup_zombies
from
.schedule
import
find_environments
,
resolve_process_path
...
...
@@ -59,13 +59,13 @@ class Work:
cpulimit
=
resolve_cpulimit_path
(
None
)
process
=
resolve_process_path
()
environments
=
find_environments
(
None
)
django_settings
=
os
.
environ
.
get
(
'
DJANGO_SETTINGS_MODULE
'
,
'
beat.web.settings.zzz
'
)
django_settings
=
os
.
environ
.
get
(
'
DJANGO_SETTINGS_MODULE
'
)
def
__call__
(
self
):
# update workers that require updates
worker_update
()
cleanup_zombies
()
work
(
Work
.
environments
,
Work
.
cpulimit
,
...
...
@@ -102,7 +102,7 @@ def scheduler(request):
cache_gb
=
int
(
cache
[
'
capacity-in-megabytes
'
]
/
1024.0
)
# do scheduling and/or worker activity if required
if
request
.
GET
.
has_key
(
'
activity
'
):
if
settings
.
SCHEDULING_PANEL
and
request
.
GET
.
has_key
(
'
activity
'
):
activity
=
request
.
GET
[
'
activity
'
]
if
activity
in
(
'
both
'
,
'
schedule
'
):
...
...
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