Burner Process
Burner Process is a wrapper that runs a function inside a newly spawned independent process that is not child to the main process, handling the function's arguments and returns (via pickle) as well as all its dependencies.
Other solutions (such as this one) rely on subprocess and thus spawn a process that is child to the main process, sharing memory and resources with it. Burner Process comes in handy when you need to run a function in an isolated environment, as a 'hard' workaround to memory leaks or inside parallel sub-processes, to monitor a specific function's resources usage.
Limitations
- The function has to be defined in a module different from the main, and the functions's module must not include importing
burner_process(see example below), which would cause circular imports. - Both arguments and returns must be pickleable
Features
- Supporting overlapping/parallel calls
- Not relying on
subprocessnormultiprocessing - Not relying on a queue for the returns
- Tested on Windows and Linux
Usage
Installation
pip install burner-process
Example
my_module.py
def my_function(x):
return x * 2
my_script.py
from burner_process import processify
from my_module import my_function
my_function_p = processify(my_function)
my_function_p(5)
>> 10
Verbose example
my_module.py
def my_function(x):
return x * 2
my_script.py
from burner_process import processify
from my_module import my_function
my_function_p = processify(my_function, verbose=True)
my_function_p(5)
>> Launching from main process (pid: 20124, parent pid: 10568)
>> Serializing arguments to C:\...\io\3
>> Running inside spawned process (pid: 18976, parent pid: 14584)
>> Serializing outputs to C:\...\io\3
>> 10
Metadata
Release files for burner-process 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| burner_process-1.0.1.tar.gz | 4.2 kB | Without provenance | Details for burner_process-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| burner_process-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for burner_process-1.0.1-py3-none-any.whl |
Total release size: 9.3 kB
Release files / burner_process-1.0.1.tar.gz
| Download URL | burner_process-1.0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb5501eaa0bb4cfc89216e4ef0efe438e3ca1abbc5a0be9e690401159e2b02f8
|
|
BLAKE2b-256 checksum How to use checksums |
4bc3bcabc5b324984309882922b143f2bd0c43575c9bf4f67717bce4ed15ec85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / burner_process-1.0.1-py3-none-any.whl
| Download URL | burner_process-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d45da372b84feaaa7dabec74c739c5425f0ece61a2b77b7cdccb87782763e583
|
|
BLAKE2b-256 checksum How to use checksums |
0b902e02660adce4f21ff8cbf84e6c6417d4db4744263c2e95e50c3796c99e28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for burner-process 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.