Skip to main content

Collect log messages and progress updates from multiple processes.

Project description

manylog

The manylog package facilitates logging and progress reporting in Python multiprocessing settings. Right now, logging across process doesn't work well, except for the natural interleaving that sometimes works acceptably when using the fork multiprocessing context. It supports log messages through the Python standard library's logging module, and progress reported with progress-api.

This package fixes that, through two parts:

  • A listener that runs in a parent process, listening for log messages and progress updates. It republishes these log messages into the parent process's logging infrastructure so filters, handlers, etc. all apply.

  • Logging and progress backend for worker processes that forwards messages to the parent process.

It is agnostic to the specific multiprocessing framework in use, and will work with stdlib multiprocessing, joblib (although Joblib lacks the setup API needed to make it work easily), ipyparallel, Torch multiprocessing, and others. It uses ZeroMQ to route messages between parent and child processes.

Currently, only single-machine multiprocessing is supported, but ZeroMQ will make it easy to add cluster log and progress aggregation in the future.

Example

In the parent:

import multiprocessing.Pool
from manylog import LogListener, init_worker_logging

with LogListener() as ll, mp.Pool(4, init_worker_logging, (ll.address,), None, mp.get_context('spawn')) as pool:
    # use `pool` to schedule parallel work

Log messages from worker processes will be routed through whatever logging and progress configuration you have set up.

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

manylog-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

manylog-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file manylog-0.1.0.tar.gz.

File metadata

  • Download URL: manylog-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for manylog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed8fbd4175eee0078a8b0529e736428547bc1ea29d42cff39bdceef179e89fc9
MD5 004ca967fb9886344e10dedc9e7846b5
BLAKE2b-256 f0151e6e80d2d2ab7bf80d4821c193de664d0ea0678d155822eb3f277d688c06

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylog-0.1.0.tar.gz:

Publisher: package.yml on mdekstrand/manylog

Attestations:

File details

Details for the file manylog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: manylog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for manylog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1728c103d422d5853aaaddc1bd8ff3cbe50757f7290c9312907caacbcf1f271
MD5 d22ebb37cff0560041540e48841046dc
BLAKE2b-256 4805734952810be7e11f7d871f227c8ddc27907c23d76d15faff83845b960ede

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylog-0.1.0-py3-none-any.whl:

Publisher: package.yml on mdekstrand/manylog

Attestations:

Supported by

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