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
dadafd6c
Commit
dadafd6c
authored
10 years ago
by
Nicolas Noble
Browse files
Options
Downloads
Plain Diff
Merge pull request #867 from ctiller/timeout2
Force-kill long running processes
parents
afcbfa1b
9b3cc746
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/jobset.py
+15
-0
15 additions, 0 deletions
tools/run_tests/jobset.py
with
15 additions
and
0 deletions
tools/run_tests/jobset.py
+
15
−
0
View file @
dadafd6c
...
@@ -43,10 +43,17 @@ import time
...
@@ -43,10 +43,17 @@ import time
_DEFAULT_MAX_JOBS
=
16
*
multiprocessing
.
cpu_count
()
_DEFAULT_MAX_JOBS
=
16
*
multiprocessing
.
cpu_count
()
have_alarm
=
False
def
alarm_handler
(
unused_signum
,
unused_frame
):
global
have_alarm
have_alarm
=
False
# setup a signal handler so that signal.pause registers 'something'
# setup a signal handler so that signal.pause registers 'something'
# when a child finishes
# when a child finishes
# not using futures and threading to avoid a dependency on subprocess32
# not using futures and threading to avoid a dependency on subprocess32
signal
.
signal
(
signal
.
SIGCHLD
,
lambda
unused_signum
,
unused_frame
:
None
)
signal
.
signal
(
signal
.
SIGCHLD
,
lambda
unused_signum
,
unused_frame
:
None
)
signal
.
signal
(
signal
.
SIGALRM
,
alarm_handler
)
def
shuffle_iteratable
(
it
):
def
shuffle_iteratable
(
it
):
...
@@ -187,6 +194,9 @@ class Job(object):
...
@@ -187,6 +194,9 @@ class Job(object):
do_newline
=
self
.
_newline_on_success
or
self
.
_travis
)
do_newline
=
self
.
_newline_on_success
or
self
.
_travis
)
if
self
.
_bin_hash
:
if
self
.
_bin_hash
:
update_cache
.
finished
(
self
.
_spec
.
identity
(),
self
.
_bin_hash
)
update_cache
.
finished
(
self
.
_spec
.
identity
(),
self
.
_bin_hash
)
elif
self
.
_state
==
_RUNNING
and
time
.
time
()
-
self
.
_start
>
300
:
message
(
'
TIMEOUT
'
,
self
.
_spec
.
shortname
,
do_newline
=
self
.
_travis
)
self
.
kill
()
return
self
.
_state
return
self
.
_state
def
kill
(
self
):
def
kill
(
self
):
...
@@ -240,6 +250,7 @@ class Jobset(object):
...
@@ -240,6 +250,7 @@ class Jobset(object):
st
=
job
.
state
(
self
.
_cache
)
st
=
job
.
state
(
self
.
_cache
)
if
st
==
_RUNNING
:
continue
if
st
==
_RUNNING
:
continue
if
st
==
_FAILURE
:
self
.
_failures
+=
1
if
st
==
_FAILURE
:
self
.
_failures
+=
1
if
st
==
_KILLED
:
self
.
_failures
+=
1
dead
.
add
(
job
)
dead
.
add
(
job
)
for
job
in
dead
:
for
job
in
dead
:
self
.
_completed
+=
1
self
.
_completed
+=
1
...
@@ -248,6 +259,10 @@ class Jobset(object):
...
@@ -248,6 +259,10 @@ class Jobset(object):
if
(
not
self
.
_travis
):
if
(
not
self
.
_travis
):
message
(
'
WAITING
'
,
'
%d jobs running, %d complete, %d failed
'
%
(
message
(
'
WAITING
'
,
'
%d jobs running, %d complete, %d failed
'
%
(
len
(
self
.
_running
),
self
.
_completed
,
self
.
_failures
))
len
(
self
.
_running
),
self
.
_completed
,
self
.
_failures
))
global
have_alarm
if
not
have_alarm
:
have_alarm
=
True
signal
.
alarm
(
10
)
signal
.
pause
()
signal
.
pause
()
def
cancelled
(
self
):
def
cancelled
(
self
):
...
...
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