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 details)

Uploaded Source

File details

Details for the file rxray-1.0.0.tar.gz.

File metadata

  • Download URL: rxray-1.0.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for rxray-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0fa6f78f727d07ff5d26d65e3628673933a3aac69e4e60c4375ee5851fb6d141
MD5 d05709987433f6b98f2674587d07ef44
BLAKE2b-256 0421e812a3844b3ff8fc060c58164a6dfb7fc900eb4cbcbfd8c8adc69a7146b3

See more details on using hashes here.

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