Skip to main content

RxPY operators to distribute computations with ray

Project description

https://badge.fury.io/py/rxray.svg Github WorkFlows

RxPy operator to distribute a computation with ray

Get Started

The distribute operator can be used directly in an existing pipeline to parallelize computations:

data = range(200)
ray.init()

rx.from_(data).pipe(
    rxray.distribute(
        lambda: rx.pipe(ops.map(lambda i: i*2)),
    ),
).subscribe()

When the distributed computation is stateful, items can be pinned to an actor with a key-based selector:

data = [(i, j) for i in range(17) for j in range(100)]
random.shuffle(data)
ray.init()

rx.from_(data).pipe(
    rxray.distribute(
        lambda: rx.pipe(
            ops.group_by(lambda i: i[0]),
            ops.flat_map(lambda g: g.pipe(
                ops.map(lambda i: i[1]),
                ops.average(),
                ops.map(lambda i: (g.key, i)),
            ))
        ),
        actor_selector=rxray.partition_by_key(lambda i: i[0]),
    ),
).subscribe()

Installation

RxRay is available on PyPi and can be installed with pip:

python3 -m pip install rxray

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

rxray-1.0.0.tar.gz (5.3 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