gevent-helpers
gevent-helpers contains a collection of utilities which are helpful while developing with gevent.
Compatible with gevent==1.0rc3.
fork()
A workaround for gevent issue 154, until that issue is fixed.
BlockingDetector(timeout=1, raise_exc=AlarmInterrupt, aggressive=True)
Use operating system signals to detect blocking threads.
timeout=1 is the number of seconds to wait before considering the thread blocked (note: if signal.setitimer or the itimer package is available, this can be a real number; otherwise it will be rounded up to the nearest integer).
raise_exc=AlarmInterrupt controls which exception will be raised in the blocking thread. If raise_exc is False-ish, no exception will be raised (a log.warning message, including stack trace, will always be issued). NOTE: the default value, AlarmInterrupt, is a subclass of BaseException, so it will not be caught by except Exception: (it will be caught by dirt.runloop). For example:
# Don't raise an exception, only log a warning message and stack trace:
BlockingDetector(raise_exc=False)
# Raise ``MyException()`` and lot a warning message:
BlockingDetector(raise_exc=MyException())
# Raise ``MyException("blocking detected after timeout=...")`` and log
# a warning message:
BlockingDetector(raise_exc=MyException)
aggressive=True determines whether the blocking detector will reset as soon as it is triggered, or whether it will wait until the blocking thread yields before it resets. For example, if aggressive=True, raise_exc=False, and timeout=1, a log message will be written for every second that a thread blocks. However, if aggressive=False, only one log message will be written until the blocking thread yields, at which point the alarm will be reset.
Note: BlockingDetector overwrites the signal.SIGALRM handler and does not attempt to save the previous value.
For example:
>>> def spinblock():
... while True:
... pass
>>> gevent.spawn(BlockingDetector())
>>> gevent.sleep()
>>> spinblock()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in spinblock
File ".../dirt/misc/gevent_.py", line 167, in alarm_handler
raise exc
gevent_helpers.AlarmInterrupt: blocking detected after timeout=1
Metadata
Release files for gevent-helpers 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gevent-helpers-0.1.1.tar.gz | 3.7 kB | Without provenance | Details for gevent-helpers-0.1.1.tar.gz |
Release files / gevent-helpers-0.1.1.tar.gz
| Download URL | gevent-helpers-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4870b19928b51b39952b40e6c696f7f97a45ee150edf407501958479b584de5b
|
|
BLAKE2b-256 checksum How to use checksums |
3fefaa2ffbd3dc58d88a2a7df24b62c9162d06650c3ca63365865345a3df2b2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gevent-helpers 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.