Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
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
Service Desk
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
tci-gateway-module
Grpc
Commits
4ff23545
Commit
4ff23545
authored
7 years ago
by
Craig Tiller
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #11318 from ctiller/eintr
Make jobset more eintr resilient
parents
60e9dac2
46356b72
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/run_tests/python_utils/jobset.py
+34
-28
34 additions, 28 deletions
tools/run_tests/python_utils/jobset.py
with
34 additions
and
28 deletions
tools/run_tests/python_utils/jobset.py
+
34
−
28
View file @
4ff23545
...
@@ -41,6 +41,7 @@ import subprocess
...
@@ -41,6 +41,7 @@ import subprocess
import
sys
import
sys
import
tempfile
import
tempfile
import
time
import
time
import
errno
# cpu cost measurement
# cpu cost measurement
...
@@ -132,29 +133,44 @@ _TAG_COLOR = {
...
@@ -132,29 +133,44 @@ _TAG_COLOR = {
_FORMAT
=
'
%(asctime)-15s %(message)s
'
_FORMAT
=
'
%(asctime)-15s %(message)s
'
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
_FORMAT
)
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
_FORMAT
)
def
eintr_be_gone
(
fn
):
"""
Run fn until it doesn
'
t stop because of EINTR
"""
while
True
:
try
:
return
fn
()
except
IOError
,
e
:
if
e
.
errno
!=
errno
.
EINTR
:
raise
def
message
(
tag
,
msg
,
explanatory_text
=
None
,
do_newline
=
False
):
def
message
(
tag
,
msg
,
explanatory_text
=
None
,
do_newline
=
False
):
if
message
.
old_tag
==
tag
and
message
.
old_msg
==
msg
and
not
explanatory_text
:
if
message
.
old_tag
==
tag
and
message
.
old_msg
==
msg
and
not
explanatory_text
:
return
return
message
.
old_tag
=
tag
message
.
old_tag
=
tag
message
.
old_msg
=
msg
message
.
old_msg
=
msg
try
:
while
True
:
if
platform_string
()
==
'
windows
'
or
not
sys
.
stdout
.
isatty
():
try
:
if
explanatory_text
:
if
platform_string
()
==
'
windows
'
or
not
sys
.
stdout
.
isatty
():
logging
.
info
(
explanatory_text
)
if
explanatory_text
:
logging
.
info
(
'
%s: %s
'
,
tag
,
msg
)
logging
.
info
(
explanatory_text
)
else
:
logging
.
info
(
'
%s: %s
'
,
tag
,
msg
)
sys
.
stdout
.
write
(
'
%s%s%s
\x1b
[%d;%dm%s
\x1b
[0m: %s%s
'
%
(
else
:
_BEGINNING_OF_LINE
,
sys
.
stdout
.
write
(
'
%s%s%s
\x1b
[%d;%dm%s
\x1b
[0m: %s%s
'
%
(
_CLEAR_LINE
,
_BEGINNING_OF_LINE
,
'
\n
%s
'
%
explanatory_text
if
explanatory_text
is
not
None
else
''
,
_CLEAR_LINE
,
_COLORS
[
_TAG_COLOR
[
tag
]][
1
],
'
\n
%s
'
%
explanatory_text
if
explanatory_text
is
not
None
else
''
,
_COLORS
[
_TAG_COLOR
[
tag
]][
0
],
_COLORS
[
_TAG_COLOR
[
tag
]][
1
],
tag
,
_COLORS
[
_TAG_COLOR
[
tag
]][
0
],
msg
,
tag
,
'
\n
'
if
do_newline
or
explanatory_text
is
not
None
else
''
))
msg
,
sys
.
stdout
.
flush
()
'
\n
'
if
do_newline
or
explanatory_text
is
not
None
else
''
))
except
:
sys
.
stdout
.
flush
()
pass
return
except
IOError
,
e
:
if
e
.
errno
!=
errno
.
EINTR
:
raise
message
.
old_tag
=
''
message
.
old_tag
=
''
message
.
old_msg
=
''
message
.
old_msg
=
''
...
@@ -226,16 +242,6 @@ class JobResult(object):
...
@@ -226,16 +242,6 @@ class JobResult(object):
self
.
cpu_measured
=
0
self
.
cpu_measured
=
0
def
eintr_be_gone
(
fn
):
"""
Run fn until it doesn
'
t stop because of EINTR
"""
while
True
:
try
:
return
fn
()
except
IOError
,
e
:
if
e
.
errno
!=
errno
.
EINTR
:
raise
def
read_from_start
(
f
):
def
read_from_start
(
f
):
f
.
seek
(
0
)
f
.
seek
(
0
)
return
f
.
read
()
return
f
.
read
()
...
...
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