No project description provided
Project description
signalflow-client-python
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.
-
Install the
signalfx
package:pip install signalfx
-
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()
-
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
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
Built Distribution
File details
Details for the file signalflow_client_python-1.3.1.tar.gz
.
File metadata
- Download URL: signalflow_client_python-1.3.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87cc8aa2d6af8fb7bf3449da8b53affc8b4c1a0849c61f1aa46d8b6469d9ead4 |
|
MD5 | 53a0f22fb7efe12650f066cc853efc4b |
|
BLAKE2b-256 | 5c7aa3392a0e5e812f6f108751cda35d88f39f06ad06e659c06eb1c945a33613 |
File details
Details for the file signalflow_client_python-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: signalflow_client_python-1.3.1-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 341110c7b962979ba5c7d033d6f987b28e923ee46d0f23508c4299a2f0ccc982 |
|
MD5 | d1fbdbd94bde6d7882a6b71f0f0cb65c |
|
BLAKE2b-256 | 86ec639c56f25d401df2addbedca027ef2fc9ac4930d64cc46fddc3b5172d98c |