A GRPC Library for Netflix Conductor
Project description
pyconductor-grpc
Python GRPC client for Netflix's Conductor
Usage
- 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
- 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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for pyconductor_grpc-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27106f9423d2067948c8591fd0bf82402cabf8753c0a786e0faa1d29217ad2a1 |
|
MD5 | f564a466bf5700b717493250bf95cba5 |
|
BLAKE2b-256 | ef492f0a235180a0b7c4e8164060ed022b0a0eef317d2850bcc11f28bec036e9 |