Skip to main content

python plugin system for jr, the data random generator

Project description

Python Plugin package for JR, the data random generator

This package implements a framework to write a producer plugin for JR in python.

Example

A simple plugin can be written as follows:

import logging
import python_jr.jrplugin as jr
import python_jr.producer_pb2 as pb2


# Define a logger with the correct level
logger = jr.Logger(logging_level=logging.DEBUG)
log = logger.log

class MyProducer(jr.JRProducer):
    def Produce(self, request, context):
        key = request.key.decode("utf-8")
        value = request.value.decode("utf-8")
        # do something with the key and value

        # return a response
        response = pb2.ProduceResponse()
        response.bytes = len(request.value)
        response.message = "Some message"

        return response


if __name__ == "__main__":
    jr.serve(MyProducer(), logger)

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

python_jr-2.1.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

python_jr-2.1.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file python_jr-2.1.3.tar.gz.

File metadata

  • Download URL: python_jr-2.1.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.12 Darwin/24.0.0

File hashes

Hashes for python_jr-2.1.3.tar.gz
Algorithm Hash digest
SHA256 58193174dbff4fb7ba4c06fcb407930e2ce4deb7680ab950844014f184d398ec
MD5 ef4210637468e9dd452febc0867ccbb1
BLAKE2b-256 67e7d831b20652adcf3c2fc4fba767638dc51be279cc7c7281ae451b1cc1a6c4

See more details on using hashes here.

File details

Details for the file python_jr-2.1.3-py3-none-any.whl.

File metadata

  • Download URL: python_jr-2.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.12 Darwin/24.0.0

File hashes

Hashes for python_jr-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b721ab0a6c2512eb12eac59f018d74bd65fdc1ec08ea948d497eb063bda9dce5
MD5 0fd77b1c16a2caf0f21757a18da6e9a7
BLAKE2b-256 e2b916bd1518cb2694d1b9bb1e7529cccb9d97fe44fc8c9d47a1d34928ebd399

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