sfalkner / pynisher Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
setup.py contains the following line:
install_requires = ['docutils>=0.3', 'setuptools', 'psutil'],
According to the docutils page 0.12 is the latest release. This can make the installation of packages which have the pynisher as a dependency fail.
There is a quickstart guide in the readme, but there should be a place that explains all arguments.
It is seemed like a exception Decorator .
Is there any more graceful or function enriched module in python,
or will be extend in the future ?
Please Let me know.
Hi,
I would like to use pynisher to limit the CPU time of algorithms called with Popen.
However, it looks like the exit_status is not correctly saved.
Please consider the following mini example:
import subprocess
import logging
import pynisher
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("Pynisher")
def run():
p = subprocess.Popen("python -c \"for i in range(99999999): i += 1\"", shell=True)
p.communicate()
obj = pynisher.enforce_limits(cpu_time_in_s=3, logger=logger)(run)
result = obj()
print(obj.exit_status, obj.wall_clock_time)
The output is:
DEBUG:Pynisher:Restricting your function to 3 seconds cpu time.
DEBUG:Pynisher:Allowing a grace period of 0 seconds.
DEBUG:Pynisher:Function called with argumen: (), {}
DEBUG:Pynisher:call function
Killed
DEBUG:Pynisher:function returned properly: (None, 0)
DEBUG:Pynisher:return value: (None, 0)
0 3.0027379989624023
I would guess that the process is killed by a SIGKILL and not by SIGXCPU (as written in the pynisher code).
Using grace_period_in_s=1
prevents the SIGKILL but the exit_status is still 0.
Playing with your code, I found that
the pynisher thinks the process was killed with SIGCHLD (17)
but catching the signal in the process (here the python process opened with Popen), it is indeed 24 (SIGXCPU).
Do you have any idea how to fix this problem?
Cheers,
Marius
when KeyboardInterrupted, The process doesn't stop in subprocess
For example, In auto-sklearn library,
They use your library for class enforce_limits
I would do pull requests for fixing this bug.
It seems like the 'pynisher' use the 'resource' library which only exists on UNIX system so it doesn't work on Windows. Is it possible to change this to support Windows system?
Right now, the pynisher shows logs like:
Wallclock time exceeded, aborting!
Your function call was aborted.
This should be optional!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.