Skip to main content

Process IO Watcher

Project description

Watchio

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 that 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 when the server has no other convenient indications of activities (such as saving accesses to a log file).

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 vim --timeout 600 --step 10
./update_script.csh

Only processes owned by you are allowed. You can supply a process name instead of a numerical process ID and watchio will look up all processes owned by you having that name.

See Also

Project Information

python-depends: psutil
docs: mkdocs
python-modules:  watchio
python-packages: watchio

Project details


Download files

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

Source Distribution

watchio-0.0.40.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

watchio-0.0.40-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file watchio-0.0.40.tar.gz.

File metadata

  • Download URL: watchio-0.0.40.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for watchio-0.0.40.tar.gz
Algorithm Hash digest
SHA256 6773102b2997256f60fc1706e2ebe0acf1dcf47df98de33a7387b3c6b0007c3f
MD5 52f1a8c07e1959c9643553726d0eadf5
BLAKE2b-256 e88a2b3a33b19fff3d2c0944d2749b3f4906cf5121449b6d91b1d7a3b43ccaaf

See more details on using hashes here.

File details

Details for the file watchio-0.0.40-py3-none-any.whl.

File metadata

  • Download URL: watchio-0.0.40-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

File hashes

Hashes for watchio-0.0.40-py3-none-any.whl
Algorithm Hash digest
SHA256 ccfd3eeabaee3d8f6a503d15513d5fc9d610235e0cb9896802dbab22b12cba16
MD5 34bfa45eeff10649b83e9dbe84c6e686
BLAKE2b-256 b1ffba35ff5a192f3f576d33675bcb6f5ef637a7d140b652a19684d73221afe5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page