Skip to content

Commit

Permalink
new update (proper timeout function for os.system)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Sep 9, 2015
1 parent 3428d16 commit 9650fae
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
* Vnext

* V1.4.0909
* fixing a few typos
* adding system function with timeout possibility
(useful for research in computer engineering where
Expand All @@ -8,6 +10,7 @@
(suggested by Anton)
* making text to select UIDs less ambiguous (asked by Anton)
* fixing bug in flatten_dict while working with CLSmith
* changing COPYRIGHT to COPYRIGHT.txt and LICENSE to LICENSE.txt

* v1.3.0824
* fixing bug with repository recaching (when pulling dependent repositories)
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 18 additions & 2 deletions ck/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"detect_cur_cid":"#",
"detect_cur_cid1":"^",

"version":["1", "3", "0824"],
"version":["1", "4", "0909"],
"error":"CK error: ",
"json_sep":"*** ### --- CK JSON SEPARATOR --- ### ***",
"default_module":"data",
Expand Down Expand Up @@ -346,6 +346,22 @@ def err(r):
out('Error: '+re)
exit(rc)

##############################################################################
# Support function for system_with_timeout

def system_with_timeout_kill(pid):
import psutil

p=psutil.Process(pid)
pc=p.get_children(recursive=True)

for px in pc:
px.kill()

p.kill()

return

##############################################################################
# Substituting os.system with possibility for time out

Expand Down Expand Up @@ -392,7 +408,7 @@ def system_with_timeout(i):
t=time.time()-t0

if t>=xto and p.poll()==None:
p.kill()
system_with_timeout_kill(p.pid)

return {'return':8, 'error':'process timed out and had been terminated'}

Expand Down
17 changes: 17 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
ck (1.4.0909) RELEASED; urgency=high

* fixing a few typos
* adding system function with timeout possibility
(useful for research in computer engineering where
generated code may be buggy and result in infinite loops,
i.e. during autotuning or compiler testing and bug detection)
* ck where repo:<name> will print URL for remote repositories
(suggested by Anton)
* making text to select UIDs less ambiguous (asked by Anton)
* fixing bug in flatten_dict while working with CLSmith
* changing COPYRIGHT to COPYRIGHT.txt and LICENSE to LICENSE.txt

-- Grigori Fursin <Grigori.Fursin@cTuning.org> 9 Sep 2015 11:12:13 +0100


ck (1.3.0824) RELEASED; urgency=high

* fixing bug with repository recaching (when pulling dependent repositories)

-- Grigori Fursin <Grigori.Fursin@cTuning.org> 24 Aug 2015 11:12:13 +0100
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Description: enabling collaborative and reproducible research and experimentatio
(by combining autotuning, run-time adaptation, machine learning
and public repository of knowledge) as described in the following
paper:
* [Interactive] http://cknowledge.org/repo
* [PDF] https://hal.inria.fr/hal-01054763/document
* [HTML] https://hal.inria.fr/hal-01054763
* [BibTex] https://hal.inria.fr/hal-01054763v1/bibtex
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='ck',
version='1.3.0824',
version='1.4.0909',
url='https://github.com/ctuning/ck',
license='BSD 3-clause',
author='Grigori Fursin and non-profit cTuning foundation',
Expand Down

0 comments on commit 9650fae

Please sign in to comment.