Skip to main content

Module burncpu is a worker dispatcher with multiprocessing and multithreading.

Features

  • All CPU cores can be used.

  • Workers can be stopped gracefully by system signals.

  • Pure python code.

Quickstart

Use the following command to run the sample module.

python3 -m burncpu.sample

Then monitor CPU status, some changes take place at these time.

Time

Events

0s

All CPU cores are IDLE.

10s

Workers begin to call one_second_task many times.

60s

Workers begin to terminate.

Pressing Ctrl+C or sending system signal can also terminate the sample.

Finally copy and modify the source code to make your own.

Reference

To import

from burncpu.dispatcher import WorkerDispatcher

class WorkerDispatcher

WorkerDispatcher.__init__(worker_count=0, use_core=0, time_limit=0)

Create a dispatcher instace.

worker_count

How many threads would be created, 0 means to create (use_core * 2) threads.

use_core

How many cores would be use, 0 means all cores.

time_limit

Stop workers after given seconds. Running functions still run at that moment. Queued functions would be cancled.

WorkerDispatcher.dispatch(func, args)

Dispatch a function to one of workers randomly.

func

Function to call.

args

Argument list of this function.

WorkerDispatcher.sleep(seconds)

Sleep dispatcher for given seconds.

seconds

Seconds to sleep. Dispatcher would not sleep given seconds actually. It sleep many times during given seconds, so that system signal (e.g. Ctrl+C) can be handled.

WorkerDispatcher.join()

Wait until all workers stopped.

WorkerDispatcher.is_alive()

Check if the dispatcher is alive.

Metadata

Release files for burncpu 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for burncpu 0.0.16
File Interpreter ABI Platform Actions
burncpu-0.0.16-py3-none-any.whl Python 3 none any Details for burncpu-0.0.16-py3-none-any.whl

Release files / burncpu-0.0.16-py3-none-any.whl

Download URL burncpu-0.0.16-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf38333a1fd4668cafbeca017ca3e472f01053446e1a1607294d23b9642fc2b9
BLAKE2b-256 checksum
How to use checksums
3cd6c49501e900c1b39c39fd5b56f9afbce685a9c83aae05b36161ab18140515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for burncpu 0.0.16

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page