Coder Social home page Coder Social logo

pynisher's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pynisher's Issues

setup_requires docutils>=0.3

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.

Missing documentation

There is a quickstart guide in the readme, but there should be a place that explains all arguments.

Are There Any Update ?

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.

exit_status for CPU limits

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

Doesn't work on Windows

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?

Make logging output optional

Right now, the pynisher shows logs like:

Wallclock time exceeded, aborting!
Your function call was aborted.

This should be optional!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.