summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 07:36:49 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 07:36:49 +0000
commita2fba99b231831fd527f30761c44d63e5c1c915b (patch)
treebe24584c8d0242074c19ae560651a9a921bada85
parenta503d4b8664f4cd57b23f49b1a8f5bc77bfdf8a6 (diff)
automatic import of python-zeebe-grpc
-rw-r--r--.gitignore1
-rw-r--r--python-zeebe-grpc.spec311
-rw-r--r--sources1
3 files changed, 313 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..7d98a98 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/zeebe_grpc-8.0.4.post1.tar.gz
diff --git a/python-zeebe-grpc.spec b/python-zeebe-grpc.spec
new file mode 100644
index 0000000..caa068e
--- /dev/null
+++ b/python-zeebe-grpc.spec
@@ -0,0 +1,311 @@
+%global _empty_manifest_terminate_build 0
+Name: python-zeebe-grpc
+Version: 8.0.4.post1
+Release: 1
+Summary: zeebe Python gRPC Gateway
+License: MIT License
+URL: https://gitlab.com/stephane.ludwig/zeebe_python_grpc
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/75/a0/05d333debd301db3294f3ef5b0e79b15cbf04c69f8a77172b9cc8ee6cc3d/zeebe_grpc-8.0.4.post1.tar.gz
+BuildArch: noarch
+
+Requires: python3-grpcio
+Requires: python3-protobuf
+
+%description
+# zeebe Python gRPC gateway files
+
+This package contains two gRPC Gateway Files needed to build a zeebe-client or a zeebe-worker (https://zeebe.io/)
+with Python.
+
+Both files were generated following the instructions on this (now outdated) blog post:
+https://zeebe.io/blog/2018/11/grpc-generating-a-zeebe-python-client/
+
+## How to install and use this package?
+
+```bash
+pip install zeebe-grpc
+```
+```python
+import json
+import logging
+import grpc
+from zeebe_grpc import gateway_pb2, gateway_pb2_grpc
+
+with grpc.insecure_channel("localhost:26500") as channel:
+ stub = gateway_pb2_grpc.GatewayStub(channel)
+
+ # print the topology of the zeebe cluster
+ topology = stub.Topology(gateway_pb2.TopologyRequest())
+ print(topology)
+
+ # deploy a process definition
+ with open("bpmn/echo.bpmn", "rb") as process_definition_file:
+ process_definition = process_definition_file.read()
+ process = gateway_pb2.ProcessRequestObject(
+ name="echo.bpmn",
+ definition=process_definition
+ )
+ stub.DeployProcess(
+ gateway_pb2.DeployProcessRequest(
+ processes=[process]
+ )
+ )
+
+ # start a process instance
+ variables = {
+ "message": "This is a Message"
+ }
+ stub.CreateProcessInstance(
+ gateway_pb2.CreateProcessInstanceRequest(
+ bpmnProcessId="ECHO",
+ version=-1,
+ variables=json.dumps(variables)
+ )
+ )
+
+ # start a worker
+ activate_jobs_response = stub.ActivateJobs(
+ gateway_pb2.ActivateJobsRequest(
+ type="echo",
+ worker="Python worker",
+ timeout=60000,
+ maxJobsToActivate=32
+ )
+ )
+ for response in activate_jobs_response:
+ for job in response.jobs:
+ try:
+ print(job.variables)
+ stub.CompleteJob(gateway_pb2.CompleteJobRequest(jobKey=job.key, variables=json.dumps({})))
+ logging.info("Job Completed")
+ except Exception as e:
+ stub.FailJob(gateway_pb2.FailJobRequest(jobKey=job.key))
+ logging.info(f"Job Failed {e}")
+```
+
+## How to (re)build the Python gRPC?
+
+```bash
+wget https://raw.githubusercontent.com/zeebe-io/zeebe/0.21.1/gateway-protocol/src/main/proto/gateway.proto -O ./zeebe_grpc/gateway.proto
+
+python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./zeebe_grpc/gateway.proto
+```
+
+
+
+%package -n python3-zeebe-grpc
+Summary: zeebe Python gRPC Gateway
+Provides: python-zeebe-grpc
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-zeebe-grpc
+# zeebe Python gRPC gateway files
+
+This package contains two gRPC Gateway Files needed to build a zeebe-client or a zeebe-worker (https://zeebe.io/)
+with Python.
+
+Both files were generated following the instructions on this (now outdated) blog post:
+https://zeebe.io/blog/2018/11/grpc-generating-a-zeebe-python-client/
+
+## How to install and use this package?
+
+```bash
+pip install zeebe-grpc
+```
+```python
+import json
+import logging
+import grpc
+from zeebe_grpc import gateway_pb2, gateway_pb2_grpc
+
+with grpc.insecure_channel("localhost:26500") as channel:
+ stub = gateway_pb2_grpc.GatewayStub(channel)
+
+ # print the topology of the zeebe cluster
+ topology = stub.Topology(gateway_pb2.TopologyRequest())
+ print(topology)
+
+ # deploy a process definition
+ with open("bpmn/echo.bpmn", "rb") as process_definition_file:
+ process_definition = process_definition_file.read()
+ process = gateway_pb2.ProcessRequestObject(
+ name="echo.bpmn",
+ definition=process_definition
+ )
+ stub.DeployProcess(
+ gateway_pb2.DeployProcessRequest(
+ processes=[process]
+ )
+ )
+
+ # start a process instance
+ variables = {
+ "message": "This is a Message"
+ }
+ stub.CreateProcessInstance(
+ gateway_pb2.CreateProcessInstanceRequest(
+ bpmnProcessId="ECHO",
+ version=-1,
+ variables=json.dumps(variables)
+ )
+ )
+
+ # start a worker
+ activate_jobs_response = stub.ActivateJobs(
+ gateway_pb2.ActivateJobsRequest(
+ type="echo",
+ worker="Python worker",
+ timeout=60000,
+ maxJobsToActivate=32
+ )
+ )
+ for response in activate_jobs_response:
+ for job in response.jobs:
+ try:
+ print(job.variables)
+ stub.CompleteJob(gateway_pb2.CompleteJobRequest(jobKey=job.key, variables=json.dumps({})))
+ logging.info("Job Completed")
+ except Exception as e:
+ stub.FailJob(gateway_pb2.FailJobRequest(jobKey=job.key))
+ logging.info(f"Job Failed {e}")
+```
+
+## How to (re)build the Python gRPC?
+
+```bash
+wget https://raw.githubusercontent.com/zeebe-io/zeebe/0.21.1/gateway-protocol/src/main/proto/gateway.proto -O ./zeebe_grpc/gateway.proto
+
+python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./zeebe_grpc/gateway.proto
+```
+
+
+
+%package help
+Summary: Development documents and examples for zeebe-grpc
+Provides: python3-zeebe-grpc-doc
+%description help
+# zeebe Python gRPC gateway files
+
+This package contains two gRPC Gateway Files needed to build a zeebe-client or a zeebe-worker (https://zeebe.io/)
+with Python.
+
+Both files were generated following the instructions on this (now outdated) blog post:
+https://zeebe.io/blog/2018/11/grpc-generating-a-zeebe-python-client/
+
+## How to install and use this package?
+
+```bash
+pip install zeebe-grpc
+```
+```python
+import json
+import logging
+import grpc
+from zeebe_grpc import gateway_pb2, gateway_pb2_grpc
+
+with grpc.insecure_channel("localhost:26500") as channel:
+ stub = gateway_pb2_grpc.GatewayStub(channel)
+
+ # print the topology of the zeebe cluster
+ topology = stub.Topology(gateway_pb2.TopologyRequest())
+ print(topology)
+
+ # deploy a process definition
+ with open("bpmn/echo.bpmn", "rb") as process_definition_file:
+ process_definition = process_definition_file.read()
+ process = gateway_pb2.ProcessRequestObject(
+ name="echo.bpmn",
+ definition=process_definition
+ )
+ stub.DeployProcess(
+ gateway_pb2.DeployProcessRequest(
+ processes=[process]
+ )
+ )
+
+ # start a process instance
+ variables = {
+ "message": "This is a Message"
+ }
+ stub.CreateProcessInstance(
+ gateway_pb2.CreateProcessInstanceRequest(
+ bpmnProcessId="ECHO",
+ version=-1,
+ variables=json.dumps(variables)
+ )
+ )
+
+ # start a worker
+ activate_jobs_response = stub.ActivateJobs(
+ gateway_pb2.ActivateJobsRequest(
+ type="echo",
+ worker="Python worker",
+ timeout=60000,
+ maxJobsToActivate=32
+ )
+ )
+ for response in activate_jobs_response:
+ for job in response.jobs:
+ try:
+ print(job.variables)
+ stub.CompleteJob(gateway_pb2.CompleteJobRequest(jobKey=job.key, variables=json.dumps({})))
+ logging.info("Job Completed")
+ except Exception as e:
+ stub.FailJob(gateway_pb2.FailJobRequest(jobKey=job.key))
+ logging.info(f"Job Failed {e}")
+```
+
+## How to (re)build the Python gRPC?
+
+```bash
+wget https://raw.githubusercontent.com/zeebe-io/zeebe/0.21.1/gateway-protocol/src/main/proto/gateway.proto -O ./zeebe_grpc/gateway.proto
+
+python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./zeebe_grpc/gateway.proto
+```
+
+
+
+%prep
+%autosetup -n zeebe-grpc-8.0.4.post1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-zeebe-grpc -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 8.0.4.post1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..fb37542
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+d96b04b567cc0bcecdc37ff50b26dbaa zeebe_grpc-8.0.4.post1.tar.gz