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
175533c8
Commit
175533c8
authored
10 years ago
by
Nathaniel Manista
Browse files
Options
Downloads
Plain Diff
Merge pull request #758 from ctiller/test
Use signals instead of sleep to wait for jobs
parents
a512c33e
336ad509
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
+8
-1
8 additions, 1 deletion
tools/run_tests/jobset.py
with
8 additions
and
1 deletion
tools/run_tests/jobset.py
+
8
−
1
View file @
175533c8
...
@@ -33,6 +33,7 @@ import hashlib
...
@@ -33,6 +33,7 @@ import hashlib
import
multiprocessing
import
multiprocessing
import
os
import
os
import
random
import
random
import
signal
import
subprocess
import
subprocess
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -42,6 +43,12 @@ import time
...
@@ -42,6 +43,12 @@ import time
_DEFAULT_MAX_JOBS
=
16
*
multiprocessing
.
cpu_count
()
_DEFAULT_MAX_JOBS
=
16
*
multiprocessing
.
cpu_count
()
# setup a signal handler so that signal.pause registers 'something'
# when a child finishes
# not using futures and threading to avoid a dependency on subprocess32
signal
.
signal
(
signal
.
SIGCHLD
,
lambda
unused_signum
,
unused_frame
:
None
)
def
shuffle_iteratable
(
it
):
def
shuffle_iteratable
(
it
):
"""
Return an iterable that randomly walks it
"""
"""
Return an iterable that randomly walks it
"""
# take a random sampling from the passed in iterable
# take a random sampling from the passed in iterable
...
@@ -232,7 +239,7 @@ class Jobset(object):
...
@@ -232,7 +239,7 @@ class Jobset(object):
if
dead
:
return
if
dead
:
return
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
))
time
.
sleep
(
0.1
)
signal
.
pause
(
)
def
cancelled
(
self
):
def
cancelled
(
self
):
"""
Poll for cancellation.
"""
"""
Poll for cancellation.
"""
...
...
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