Skip to main content

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

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
    ver: 0.1.0
    steps:
        - name: step 1
          id: step1
          uses: acts.core.irq
          params:
            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()

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

acts_channel-0.5.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acts_channel-0.5.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file acts_channel-0.5.0.tar.gz.

File metadata

  • Download URL: acts_channel-0.5.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for acts_channel-0.5.0.tar.gz
Algorithm Hash digest
SHA256 41f806b3b33c7b5701d23c0e60bcc61d85f5403815d5d801c3fc5250ca55af9d
MD5 b952fe2eb1e89158c88bb9a03345d2b7
BLAKE2b-256 3ba1e3ff723960b2e863ba635337e2c392646d14038cae102d8e551b6d92dca0

See more details on using hashes here.

File details

Details for the file acts_channel-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for acts_channel-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50a91f32881c812b13d994ded5cbbdc627d0625901494b89ed2732b8800e2a21
MD5 5827c3c041a514c8bf51be6806a79916
BLAKE2b-256 c05ed3a7a7dd35d8770c03e1a977c1ee9cdf97de3c750631b728ec5b6ad23591

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page