Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
ae488ce3
Commit
ae488ce3
authored
Aug 25, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write regular time stamps into the test log to spot slow running tests.
parent
51c1f8fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
6 deletions
+46
-6
runtests.py
runtests.py
+46
-6
No files found.
runtests.py
View file @
ae488ce3
...
@@ -17,6 +17,7 @@ import traceback
...
@@ -17,6 +17,7 @@ import traceback
import
warnings
import
warnings
import
zlib
import
zlib
import
glob
import
glob
from
contextlib
import
contextmanager
try
:
try
:
import
platform
import
platform
...
@@ -2042,6 +2043,8 @@ def main():
...
@@ -2042,6 +2043,8 @@ def main():
pool = multiprocessing.Pool(options.shard_count)
pool = multiprocessing.Pool(options.shard_count)
tasks = [(options, cmd_args, shard_num) for shard_num in range(options.shard_count)]
tasks = [(options, cmd_args, shard_num) for shard_num in range(options.shard_count)]
errors = []
errors = []
# NOTE: create process pool before time stamper thread to avoid forking issues.
with time_stamper_thread():
for shard_num, return_code in pool.imap_unordered(runtests_callback, tasks):
for shard_num, return_code in pool.imap_unordered(runtests_callback, tasks):
if return_code != 0:
if return_code != 0:
errors.append(shard_num)
errors.append(shard_num)
...
@@ -2055,6 +2058,7 @@ def main():
...
@@ -2055,6 +2058,7 @@ def main():
else:
else:
return_code = 0
return_code = 0
else:
else:
with time_stamper_thread():
_, return_code = runtests(options, cmd_args, coverage)
_, return_code = runtests(options, cmd_args, coverage)
print("ALL DONE")
print("ALL DONE")
...
@@ -2067,6 +2071,42 @@ def main():
...
@@ -2067,6 +2071,42 @@ def main():
sys.exit(return_code)
sys.exit(return_code)
@contextmanager
def time_stamper_thread(interval=10):
"""
Print
regular
time
stamps
into
the
build
logs
to
find
slow
tests
.
@
param
interval
:
time
interval
in
seconds
"""
try:
_xrange = xrange
except NameError:
_xrange = range
import threading
from datetime import datetime
from time import sleep
interval = _xrange(interval * 4)
now = datetime.now
stop = False
def time_stamper():
while True:
for _ in interval:
if stop:
return
sleep(1./4)
print('
\
n
#### %s' % now())
thread = threading.Thread(target=time_stamper)
thread.start()
try:
yield
finally:
stop = True
thread.join()
def configure_cython(options):
def configure_cython(options):
global CompilationOptions, pyrex_default_options, cython_compile
global CompilationOptions, pyrex_default_options, cython_compile
from Cython.Compiler.Main import
\
from Cython.Compiler.Main import
\
...
...
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