Name | acts-channel JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | acts channel client |
upload_time | 2024-12-04 10:52:45 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT |
keywords |
workflow
acts-server
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# acts-channel
Acts-channel is a workflow client to connect to [`acts-server`](https://github.com/yaojianpin/acts-server)
# Usage
Before connecting, please download [`acts-server`](https://github.com/yaojianpin/acts-server) and start it
```console
pip install acts-channel
```
## Example
```py
import signal
import sys
import time
from acts_channel import Channel
def signal_handler(signal, frame):
print('Caught Ctrl+C / SIGINT signal')
sys.exit(0)
def main():
chan = 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
"""
resp = chan.deploy(model)
ret = resp.unwrap_or_raise(ValueError)
print("chan.deploy:", ret)
resp = chan.send("model:get", { "id": "test", "fmt": "tree"})
print(resp.ok_value["data"])
chan.subscribe("client-1", on_message)
resp = chan.start("test", { "custom": "aaa" })
print(resp.ok_value)
print("waiting for all messages...")
time.sleep(5)
def on_message(chan: Channel, message):
print(f"on_message: {message}")
if message["key"] == "abc":
chan.act("complete", message["pid"], message["tid"], {})
if __name__ == "__main__":
main()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "acts-channel",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "workflow, acts-server",
"author": null,
"author_email": "yaojianping <yaojianpin@sohu.com>",
"download_url": "https://files.pythonhosted.org/packages/dc/c5/50c07cc9af397bf28481a25ef75fa155ec059e9637242b7c344ce09443ce/acts_channel-0.2.0.tar.gz",
"platform": null,
"description": "# acts-channel\n\nActs-channel is a workflow client to connect to [`acts-server`](https://github.com/yaojianpin/acts-server)\n\n# Usage\n\nBefore connecting, please download [`acts-server`](https://github.com/yaojianpin/acts-server) and start it\n\n```console\npip install acts-channel\n```\n\n## Example\n\n```py\nimport signal\nimport sys\nimport time\n\nfrom acts_channel import Channel\n\n\ndef signal_handler(signal, frame):\n print('Caught Ctrl+C / SIGINT signal')\n sys.exit(0)\n\ndef main():\n chan = Channel(url = \"127.0.0.1:10080\")\n signal.signal(signal.SIGINT, signal_handler)\n model = \"\"\"\n id: test\n name: workflow in python\n steps:\n - name: step 1\n id: step1\n acts:\n - act: irq\n key: abc\n \"\"\"\n resp = chan.deploy(model)\n\n ret = resp.unwrap_or_raise(ValueError)\n print(\"chan.deploy:\", ret)\n\n resp = chan.send(\"model:get\", { \"id\": \"test\", \"fmt\": \"tree\"})\n print(resp.ok_value[\"data\"])\n\n chan.subscribe(\"client-1\", on_message)\n\n resp = chan.start(\"test\", { \"custom\": \"aaa\" })\n print(resp.ok_value)\n\n print(\"waiting for all messages...\")\n time.sleep(5)\n\ndef on_message(chan: Channel, message):\n print(f\"on_message: {message}\")\n if message[\"key\"] == \"abc\":\n chan.act(\"complete\", message[\"pid\"], message[\"tid\"], {})\n\n\nif __name__ == \"__main__\":\n main()\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "acts channel client",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"workflow",
" acts-server"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "310d4886fe30703b3fdc3fba017362d2df529a6c6f83cb0efe29464811666f4a",
"md5": "58d18e20136cca2fd0e28b184bd762f7",
"sha256": "bdaf734e138122e0b53a8dec524db75d913c602e5c8ea1b0b5f1e25f07981a15"
},
"downloads": -1,
"filename": "acts_channel-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "58d18e20136cca2fd0e28b184bd762f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7521,
"upload_time": "2024-12-04T10:52:43",
"upload_time_iso_8601": "2024-12-04T10:52:43.595267Z",
"url": "https://files.pythonhosted.org/packages/31/0d/4886fe30703b3fdc3fba017362d2df529a6c6f83cb0efe29464811666f4a/acts_channel-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dcc550c07cc9af397bf28481a25ef75fa155ec059e9637242b7c344ce09443ce",
"md5": "3615f72bd549b9a4958861724dfd32f4",
"sha256": "ea5083e7f5f3d0cf1d5b2db8c677c32754ea417533c0fa9515864e6a74563e25"
},
"downloads": -1,
"filename": "acts_channel-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "3615f72bd549b9a4958861724dfd32f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6509,
"upload_time": "2024-12-04T10:52:45",
"upload_time_iso_8601": "2024-12-04T10:52:45.231337Z",
"url": "https://files.pythonhosted.org/packages/dc/c5/50c07cc9af397bf28481a25ef75fa155ec059e9637242b7c344ce09443ce/acts_channel-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 10:52:45",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "acts-channel"
}