acts channel client
Project description
acts-channel
Acts-channel is a workflow client to connect to acts-server
Usage
Before connecting, please download acts-server and start it
pip install acts-channel
Example
import signal
import sys
import time
import acts_channel
def signal_handler(signal, frame):
print('Caught Ctrl+C / SIGINT signal')
sys.exit(0)
def main():
chan = channel.Channel(url = "127.0.0.1:10080")
signal.signal(signal.SIGINT, signal_handler)
model = """
id: test
name: workflow in python
steps:
- name: step 1
id: step1
acts:
- act: irq
key: abc
"""
# deploy a workflow model
resp = chan.deploy(model)
print(resp.ok_value)
# get the model info
resp = chan.send("model:get", { "id": "test", "fmt": "tree"})
print(resp.ok_value["data"])
# subscribe messages from server
chan.subscribe("client-1", on_message)
# start a workflow by model id and custom data
resp = chan.start("test", { "custom": "aaa" })
print(resp.ok_value)
print("waiting for all messages...")
time.sleep(5)
def on_message(chan: channel.Channel, message):
print(f"on_message: {message}")
if message["key"] == "abc":
# execute act from client
chan.act("complete", message["pid"], message["tid"], {})
if __name__ == "__main__":
main()
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
acts_channel-0.1.0.tar.gz
(4.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acts_channel-0.1.0.tar.gz.
File metadata
- Download URL: acts_channel-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.1 CPython/3.12.6 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98acfd5f63dadd92d0ffc43bd8012302df8adec8be3690057fdbd3fe4f9bcbf1
|
|
| MD5 |
0ff21cfdb411b91c4aa7ab6e1c235538
|
|
| BLAKE2b-256 |
6b0026b202148f6209ce26c0724d95089ccf328f61b3e16e314fa8419a2dad21
|
File details
Details for the file acts_channel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: acts_channel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.1 CPython/3.12.6 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb5a94c389ee2c5872415025b6673abc9d7fd516a2110cb329b79720ee573c4e
|
|
| MD5 |
9d7cf64641c723a55bbeb6e2cce23c05
|
|
| BLAKE2b-256 |
aa2e3445487e21fd41ebea859e428ba59665bc93251cbe8e4c9c0cf99f48c766
|