Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
multiprocessing-logging
Advanced tools
When using the multiprocessing
module, logging becomes less useful since
sub-processes should log to individual files/streams or there's the risk of
records becoming garbled.
This simple module implements a Handler
that when set on the root
Logger
will handle tunneling the records to the main process so that
they are handled correctly.
It's currently tested in Linux and Python 2.7 & 3.6+.
Pypy3 hangs on the tests so I don't recommend using it.
Pypy appears to be working, recently.
Only works on POSIX systems and only Linux is supported. It does not work on Windows.
This library was taken verbatim from a StackOverflow post and extracted into a module so that I wouldn't have to copy the code in every project.
Later, several improvements have been contributed.
Before you start logging but after you configure the logging framework (maybe with logging.basicConfig(...)
), do the following:
import multiprocessing_logging
multiprocessing_logging.install_mp_handler()
and that's it.
When using a Pool, make sure install_mp_handler
is called before the Pool is instantiated, for example:
import logging
from multiprocessing import Pool
from multiprocessing_logging import install_mp_handler
logging.basicConfig(...)
install_mp_handler()
pool = Pool(...)
The approach of this module relies on fork being used to create new processes. This start method is basically unsafe when also using threads, as this module does.
The consequence is that there's a low probability of the application hanging when creating new processes.
As a palliative, don't continuously create new processes. Instead, create a Pool once and reuse it.
FAQs
Logger for multiprocessing applications
We found that multiprocessing-logging demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.