Skip to main content

GCP Asyncio PubSub RPC Client

Google Cloud PubSub RPC Client is a lightweight Python package designed for managing and orchestrating job submissions across asynchronous environments using Google Cloud Pub/Sub. This package facilitates seamless integration of job queues, providing tools to submit jobs, and handle their responses efficiently. With built-in support for Prometheus metrics, it allows users to monitor job submission rates, success rates, processing times, and more, ensuring optimal performance and reliability. Whether you're handling sporadic tasks or managing continuous streams of jobs, PubSub RPC Client ensures that your job processing is scalable, efficient, and fully monitored.

Getting Started

Go to the examples folder to see how to quickly get a sample client and server up and running.

Creating Google Cloud Pub/Sub Topics Using gcloud

To create the Pub/Sub topics job-topic and response-topic from your command line, follow these steps:

Create job-topic and response-topic:

Run the following command to create the job-topic:

gcloud pubsub topics create job-topic
gcloud pubsub topics create response-topic

These commands will create the specified topics in your Google Cloud project, allowing you to publish and subscribe to messages.

Running examples

After creating topics, install the dependencies with poetry install. The project-name is the GCP project where your topics are defined.

Running a client:

To run the client (streaming or non-streaming):

# Streaming client
poetry run python examples/stream_client.py project-name response-topic job-topic

# Non-streaming client
poetry run python examples/client.py project-name response-topic job-topic

Running the server:

To run the server:

poetry run python examples/stream_server.py project-name job-topic response-topic

The server supports both streaming and non-streaming results out of the box. To extend the server, subclass PubSubRPCServer and provide definitions for process_stream_message and process_message.

The server will handle terminating the stream and routing the messages back to the client.

Metadata

Release files for gcloud-aio-pubsub-rpc 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gcloud-aio-pubsub-rpc 0.1.1
File Size Uploaded
gcloud_aio_pubsub_rpc-0.1.1.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gcloud-aio-pubsub-rpc 0.1.1
File Interpreter ABI Platform
gcloud_aio_pubsub_rpc-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.7 kB

Release files / gcloud_aio_pubsub_rpc-0.1.1.tar.gz

Download URL gcloud_aio_pubsub_rpc-0.1.1.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ab23d3c95bdf86db9c655543c57779839325052a14339baa25fe62f80dc816f9
BLAKE2b-256 checksum
How to use checksums
ae8dcfefa07cdcd03514b0f2aa4581d4a19a594544ba42f5e2e56ec7833cabf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.8 Linux/6.5.0-35-generic

Release files / gcloud_aio_pubsub_rpc-0.1.1-py3-none-any.whl

Download URL gcloud_aio_pubsub_rpc-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
449b9d73e7ae109d0694d835f3aac2915cfbf36886d58bae3c9de4a94b4f1201
BLAKE2b-256 checksum
How to use checksums
5de645deb6a0946fef565678c13763042ec921035de36c56c29e6637e80a91b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.8 Linux/6.5.0-35-generic

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page