Skip to main content

No project description provided

Project description

signalflow-client-python

PyPI - Version PyPI - Python Version


Table of Contents

Installation

To install the SignalFlow Python client library, open a terminal and run the following command:

pip install signalflow-client-python

Run a SignalFlow computation

The following example allows you run a SignalFlow computation from the command line. For additional examples, see the examples directory.

  1. Install the signalfx package:

    pip install signalfx
    
  2. Create a .py file that includes the following content:

#!/usr/bin/env python

import argparse

from signalfx.signalflow import SignalFlowClient


def main():
    parser = argparse.ArgumentParser(
        description="SignalFx SignalFlow streaming analytics demo"
    )
    parser.add_argument(
        "--stream-endpoint",
        help="SignalFx SignalFlow stream API endpoint",
        default="https://stream.signalfx.com",
    )
    parser.add_argument("token", help="Your SignalFx API access token")
    parser.add_argument("program", help="SignalFlow program to execute")
    options = parser.parse_args()
    client = SignalFlowClient(
        token=options.token,
        endpoint=options.stream_endpoint,
    )
    try:
        # Execute the computation and iterate over the message stream
        print("Requesting computation: {0}".format(options.program))
        c = client.execute(options.program)
        print("Waiting for data...")
        for msg in c.stream():
            print(f"Message: {msg}")
    except KeyboardInterrupt:
        print("Detaching from computation...")
    finally:
        client.close()
    print("Done.")


if __name__ == "__main__":
    main()
  1. Run the Python script, specifying values for the streaming endpoint (optional), the API access token, and the SignalFlow program.

    For example:

    python <file-name>.py --stream-endpoint https://stream.us0.signalfx.com <api-token> "data('sf.org.num.orguser').publish()"
    

License

signalflow-client-python is distributed under the terms of the Apache-2.0 license.

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

signalflow_client_python-1.3.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

signalflow_client_python-1.3.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file signalflow_client_python-1.3.1.tar.gz.

File metadata

File hashes

Hashes for signalflow_client_python-1.3.1.tar.gz
Algorithm Hash digest
SHA256 87cc8aa2d6af8fb7bf3449da8b53affc8b4c1a0849c61f1aa46d8b6469d9ead4
MD5 53a0f22fb7efe12650f066cc853efc4b
BLAKE2b-256 5c7aa3392a0e5e812f6f108751cda35d88f39f06ad06e659c06eb1c945a33613

See more details on using hashes here.

File details

Details for the file signalflow_client_python-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for signalflow_client_python-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 341110c7b962979ba5c7d033d6f987b28e923ee46d0f23508c4299a2f0ccc982
MD5 d1fbdbd94bde6d7882a6b71f0f0cb65c
BLAKE2b-256 86ec639c56f25d401df2addbedca027ef2fc9ac4930d64cc46fddc3b5172d98c

See more details on using hashes here.

Supported by

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