Skip to main content

A GRPC Library for Netflix Conductor

Project description

pyconductor-grpc

Python GRPC client for Netflix's Conductor

Usage

  1. Define your work function:
def sleep_work_function(sleep_duration: int, sleep_message: str, **kwargs) -> dict:
    time.sleep(sleep_duration)
    output_data = {'message': sleep_message}
    return output_data
  1. Work
with TaskWorker(
    task_concurrency=25,
    task_service=TaskService(),
    task_type='sleep',
    work_function=work_function,
    work_concurrency=10,
) as worker:
    worker.work()

Code generation

scripts/generate-code.sh

Notes

The generated Python message types verify field types when objects are constructed from them. For example:

>>> from model.task_result_pb2 import TaskResult
>>> TaskResult(task_id=1)
TypeError: Cannot set conductor.proto.TaskResult.task_id to 0: 0 has type <class 'int'>, but expected one of: (<class 'bytes'>, <class 'str'>) for field TaskResult.task_id
>>> TaskResult(task_id='1')
>>>

Publishing

To build and upload:

pip install --upgrade build twine
python -m build
twine upload dist/*

or

pipx install build
pipx install twine
pyproject-build
twine upload dist/*

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

pyconductor_grpc-0.0.9.tar.gz (47.6 kB view hashes)

Uploaded Source

Built Distribution

pyconductor_grpc-0.0.9-py3-none-any.whl (75.9 kB view hashes)

Uploaded Python 3

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