Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Run parallel jobs and save results to json.gz files

Project description

PyPI version Build Status codecov

Run parallel jobs and save results to json.gz files.

Install

Stable:

pip install ultrachronic

Latest:

pip install git+https://github.com/yoavram/ultrachronic.git

Supports Python 3.4 and 3.5.

Test

Requirements:

pip install nose click

Run:

nosetests tests

Example

Code in do_something.py:

from ultrachronic import jsonify_result, repeat

import click

@jsonify_result
def do_something(arg1, arg2):
    a = 1
    b = 2
    # must return a dict!
    return dict(a=a, b=b)

@click.command()
@click.option('--arg1', default=1, type=int, help='Argument 1')
@click.option('--arg2', default='a', type=str, help='Argument 2')
@click.option('--reps', default=1, type=click.IntRange(1, None), help='Number of repetitions')
@click.option('--cpus', default=1, type=int, help='Number of CPUs to use (<1 for all available)')
def main(arg1, arg2, reps, cpus):
    repeat(do_something, reps, cpus, arg1=arg1, arg2=arg2)

if __name__ == '__main__':
    main()

Usage:

python do_something.py
python do_something.py --reps 10 --cpus 2
python do_something.py --arg1 5 --reps 10 --cpus 1
python do_something.py --arg2 hi --reps 10 --cpus 0

Authors

  • Yoav Ram (@yoavram)

Project details


Release history Release notifications

This version
History Node

0.1.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
ultrachronic-0.1.5-py2.py3-none-any.whl (5.2 kB) Copy SHA256 hash SHA256 Wheel py2.py3
ultrachronic-0.1.5-py3.4.egg (5.8 kB) Copy SHA256 hash SHA256 Egg 3.4
ultrachronic-0.1.5-py3.5.egg (5.8 kB) Copy SHA256 hash SHA256 Egg 3.5
ultrachronic-0.1.5-py3.6.egg (5.7 kB) Copy SHA256 hash SHA256 Egg 3.6
ultrachronic-0.1.5.tar.gz (19.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page