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
Lisa Casino
slapos.core
Commits
da8b1d18
Commit
da8b1d18
authored
Dec 03, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.grid: do not ALWAYS sleep for promise_timeout.
Instead, poll often, and continue if promise finished.
parent
ffb2abfb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+19
-10
No files found.
slapos/grid/slapgrid.py
View file @
da8b1d18
...
...
@@ -541,18 +541,27 @@ class Slapgrid(object):
process_handler
.
stdin
.
close
()
process_handler
.
stdin
=
None
time
.
sleep
(
self
.
promise_timeout
)
# Check if the promise finished every tenth of second,
# but timeout after promise_timeout.
sleep_time
=
0.1
increment_limit
=
int
(
self
.
promise_timeout
/
sleep_time
)
for
current_increment
in
range
(
0
,
increment_limit
):
if
process_handler
.
poll
()
is
None
:
process_handler
.
terminate
()
raise
Slapgrid
.
PromiseError
(
"The promise '%s' timed out"
%
promise
)
elif
process_handler
.
poll
()
!=
0
:
time
.
sleep
(
sleep_time
)
continue
if
process_handler
.
poll
()
==
0
:
# Success!
break
else
:
stderr
=
process_handler
.
communicate
()[
1
]
if
stderr
is
None
:
stderr
=
"No error output from '%s'."
%
promise
else
:
stderr
=
"Promise '%s':"
%
promise
+
stderr
raise
Slapgrid
.
PromiseError
(
stderr
)
else
:
process_handler
.
terminate
()
raise
Slapgrid
.
PromiseError
(
"The promise '%s' timed out"
%
promise
)
if
not
promise_present
:
self
.
logger
.
info
(
"No promise."
)
...
...
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