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

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.4.0.tar.gz (7.1 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.4.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for acts_channel-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8c2aa89858567693228c2d08c2d47569782a91bc8f7663ddcabe90b56c2c230d
MD5 7afd48834464c689da153d1e3de320b3
BLAKE2b-256 9b5412c94728c3e44b53e3021d185246fb3e435453047979e8340bbc8bc7f022

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for acts_channel-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96d00447566ff2850d5892a3f7b679e31f5778942dba95a83230fd720b8925a1
MD5 176f3fa6254a645151bb0c4c80b935b7
BLAKE2b-256 bbb3d10577bb4d6415f86d7cfa05ce7326f9d55ca72151fb2ab0ac52772ce695

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