Skip to main content

Pravega client

Project description

CIbuild codecov

Pravega Python client.

This project provides a way to interact with Pravega using Python client.

Pravega is an open source distributed storage service implementing Streams. It offers Stream as the main primitive for the foundation of reliable storage systems: a high-performance, durable, elastic, and unlimited append-only byte stream with strict ordering and consistency.

This project supports interaction with Pravega for Python versions 3.8+. For a quick tutorial on the Python bindings visit the book.

Also check out the Pravega Python client API documents.

Install

The client library can be installed using pip.

pip install pravega

The users can also choose to generate the bindings using the commands specified at PythonBinding .

Example

Write events

import pravega_client
# assuming Pravega controller is listening at 127.0.0.1:9090
stream_manager = pravega_client.StreamManager("tcp://127.0.0.1:9090")

scope_result = stream_manager.create_scope("scope_foo")
self.assertEqual(True, scope_result, "Scope creation status")

stream_result = stream_manager.create_stream("scope_foo", "stream_bar", 1) # initially stream contains 1 segment
self.assertEqual(True, stream_result, "Stream creation status")

writer = stream_manager.create_writer("scope_foo","stream_bar")
writer.write_event("hello world")

Read events

import pravega_client
# assuming Pravega controller is listening at 127.0.0.1:9090
stream_manager = pravega_client.StreamManager("tcp://127.0.0.1:9090")

reader_group = stream_manager.create_reader_group("my_reader_group", "scope_foo", "stream_bar")

reader = reader_group.create_reader("my_reader");

# acquire a segment slice to read
slice = await reader.get_segment_slice_async()
for event in slice:
    print(event.data())
    
# after calling release segment, data in this segment slice will not be read again by
# readers in the same reader group.
reader.release_segment(slice)

# remember to mark the finished reader as offline.
reader.reader_offline()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pravega-0.3.0-cp39-none-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pravega-0.3.0-cp39-cp39-manylinux_2_24_x86_64.whl (5.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

pravega-0.3.0-cp39-cp39-macosx_10_7_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

pravega-0.3.0-cp38-none-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pravega-0.3.0-cp38-cp38-manylinux_2_24_x86_64.whl (5.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

pravega-0.3.0-cp38-cp38-macosx_10_7_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

pravega-0.3.0-cp37-none-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.7 Windows x86-64

pravega-0.3.0-cp37-cp37m-manylinux_2_24_x86_64.whl (5.5 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

pravega-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

pravega-0.3.0-cp36-none-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.6 Windows x86-64

pravega-0.3.0-cp36-cp36m-manylinux_2_24_x86_64.whl (5.4 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ x86-64

pravega-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.6m macOS 10.7+ x86-64

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