Skip to main content

Convenient multiprocessing function for Python

Project description

tools-mp

This Python library provides a convenient one-line multiprocessing option that can be used as follows:

from tools_mp import multiprocess

def any_function( arg_1, arg_2, ..., arg_n ):
	do something
	return result

args = [ 
	{
		'arg_1': arg_1,
		'arg_2': arg_2,
		...
		'arg_n': arg_n,
		} for arg_1, arg_2, ..., arg_n in arguments
	]

data = multiprocess(
	function = any_function,
	args = args,
	return_data = True,
	verbose = True,
	workers = 8,
	)

If verbose=True, the progress of the calculation will be visualized via the tqdm library. If workers=None (default) all available CPU cores will be used for processing.

Installation

pip install tools-mp

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

tools-mp-0.1.1.tar.gz (3.8 kB view hashes)

Uploaded Source

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