Skip to main content

Specify a timeout with any given function

Project description

Build Status

bombfuse

Python module for specifying timeouts when executing functions

Installation

To install this package, run the following command:

$ pip install bombfuse

Usage

>>> import time
>>> import bombfuse
>>> import sys
>>> # here's an infinite loop
>>> def func(msg):
>>>     while True:
>>>         time.sleep(1)
>>>         sys.stdout.write(msg + "\n")
>>>         sys.stdout.flush()
>>>
>>> # time out in 5 seconds
>>> bombfuse.timeout(5, func, "Hello world!")
Hello world!
Hello world!
Hello world!
Hello world!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bombfuse\__init__.py", line 64, in timeout
    raise e
bombfuse.TimeoutError: The function 'func' timed out
>>>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bombfuse, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size bombfuse-0.3.2-py2-none-any.whl (3.2 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size bombfuse-0.3.2.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page