Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-bata/pysigdump
Use signal to show stacktrace and garbage collection stats of a Python process.
https://github.com/c-bata/pysigdump
Last synced: 14 days ago
JSON representation
Use signal to show stacktrace and garbage collection stats of a Python process.
- Host: GitHub
- URL: https://github.com/c-bata/pysigdump
- Owner: c-bata
- Created: 2019-12-06T12:07:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-06T14:13:16.000Z (almost 5 years ago)
- Last Synced: 2024-10-08T21:06:31.607Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.org/project/sigdump/
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
pysigdump
=========Use signal to show stacktrace and garbage collection stats of a Python process like `frsyuki/sigdump `_.
Usage
-----Server example to enable sigdump is below:
.. code-block:: python
import os
import sigdump
from wsgiref.simple_server import make_serverdef application(env, start_response):
start_response('200 OK', [('Content-type', 'text/plain; charset=utf-8')])
return [b'Hello World']if __name__ == '__main__':
sigdump.enable(verbose=True) # just calling sigdump.signal().
httpd = make_server('', 8000, application)
httpd.serve_forever().. code-block:: console
$ pip install sigdump
$ python example/wsgi.py
SIGDUMP is enabled. The result is exported to /tmp/sigdump-57650.log.Then sending a ``SIGCONT`` signal.
Please set ``SIGDUMP_SIGNAL`` environment variable if you want to change the signal... code-block:: console
$ kill -s SIGCONT 57650
See ``/tmp/sigdump-.log``.
Please set ``SIGDUMP_PATH`` environment variable if you want to change the output path.
You can set ``"-"`` here to dump to ``STDOUT``, or ``"+"`` to ``STDERR``... code-block:: console
$ less /tmp/sigdump-57650.log
Sigdump at 2019-12-06 21:04:55.071633 process 57650Stacktrace:
File "example/wsgi.py", line 15, in
httpd.serve_forever()
File "/Users/c-bata/.pyenv/versions/3.7.1/lib/python3.7/socketserver.py", line 232, in serve_forever
ready = selector.select(poll_interval)
File "/Users/c-bata/.pyenv/versions/3.7.1/lib/python3.7/selectors.py", line 415, in select
fd_event_list = self._selector.poll(timeout)GC stat:
Generation 0:
collections : 33
collected : 99
uncollectable : 0
Generation 1:
collections : 2
collected : 253
uncollectable : 0
Generation 2:
collections : 0
collected : 0
uncollectable : 0LICENSE
-------::
MIT License
Copyright (c) 2019 Masashi SHIBATA
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.