Process IO Watcher
Project description
watchio -- Python package to watch process IO
The watchio
package provides utilities to watch for IO activities of Unix processes. It
works by reading the Unix process information file /proc/{pid}/io
periodically. You can
only use it on a system where /proc
is mounted, and for processes you have tracing
access to.
An example use case is a microserver displaying static web pages created by a separate
program that takes a moderate amount of resources. A sensible implementation updates the
static pages only when users are viewing the results. The watchio
module helps to watch
for IO activities of the server.
Install the package from pypi.org
by
pip install watchio
Usage
In a polling loop in Python code:
watcher = watchio.WatchIO([123, 456])
## Use in a polling loop to update static web pages
## poll() will return an integer
## -1: every 600 seconds, or
## >0: there are IO activities (checked every 10 seconds)
while True:
if watcher.poll(timeout=600, step=10):
## main work
....
On the Unix command line
watchio poll 1234 2234 --timeout 600 --step 10
./update_script.csh
See Also
- Unix /proc file system man page
- iostat man page
- Code on github: https://github.com/koobedoc/watchio
- Package on PyPI: https://pypi.org/project/watchio/
- Online documentation: https://koobedoc.github.io/watchio/
Project Information (YAML format)
python-depends: psutil
docs: mkdocs
python-modules: watchio
python-packages: watchio
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.