Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
5139881c
Commit
5139881c
authored
Jan 30, 2018
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix failure when psutil read info and the process is gone
parent
19e30890
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
slapos/grid/utils.py
slapos/grid/utils.py
+14
-9
slapos/tests/grid_utils.py
slapos/tests/grid_utils.py
+3
-0
No files found.
slapos/grid/utils.py
View file @
5139881c
...
...
@@ -428,16 +428,21 @@ def checkPromiseList(promise_dir, promise_timeout, uid=None, gid=None, cwd=None,
for
current_increment
in
range
(
0
,
increment_limit
):
if
process_handler
.
poll
()
is
None
:
if
check_profile
:
try
:
io_counter
=
psutil_process
.
io_counters
()
logger
.
debug
(
"[t=%ss] CPU: %s%%, MEM: %s MB (%s%%), DISK: %s Read - %s Write"
%
(
current_increment
*
sleep_time
,
psutil_process
.
cpu_percent
(),
psutil_process
.
memory_info
().
rss
/
float
(
2
**
20
),
round
(
psutil_process
.
memory_percent
(),
4
),
psutil_process
.
io_counters
()
.
read_count
,
psutil_process
.
io_counters
()
.
write_count
io_counter
.
read_count
,
io_counter
.
write_count
)
)
except
(
psutil
.
AccessDenied
,
psutil
.
NoSuchProcess
):
# defunct process will raise AccessDenied
pass
time
.
sleep
(
sleep_time
)
continue
result_dict
[
"execution-time"
]
=
current_increment
*
sleep_time
...
...
slapos/tests/grid_utils.py
View file @
5139881c
...
...
@@ -37,6 +37,7 @@ class TestGridUtils(unittest.TestCase):
"""
script
=
"""#!/bin/sh
echo "%(name)s"
sleep 0.1
exit %(code)s
"""
root_directory
=
tempfile
.
mkdtemp
()
...
...
@@ -74,6 +75,7 @@ exit %(code)s
"""
script
=
"""#!/bin/sh
echo "%(name)s"
sleep 0.1
exit %(code)s
"""
root_directory
=
tempfile
.
mkdtemp
()
...
...
@@ -104,6 +106,7 @@ exit %(code)s
"""
script
=
"""#!/bin/sh
echo "%(name)s"
sleep 0.1
exit %(code)s
"""
root_directory
=
tempfile
.
mkdtemp
()
...
...
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