A minimal Python client to publish events to the Outerbounds platform.
Project description
Python package to publish events to the Outerbounds platform
Installation
Install the package using pip:
pip install ob-events
If you want to use IAM authentication, you need some additional dependencies:
pip install ob-events[aws]
Usage
Metaflow Flow (The Receiver)
First, assume you have a Metaflow Flow that is triggered by an event, like my_event.
from metaflow import FlowSpec, step, current, trigger
@trigger(event='my_event')
class NodeSimpleTriggeredFlow(FlowSpec):
@step
def start(self):
self.var_1 = ["h", "e", "l", "l"]
self.next(self.b, foreach='var_1')
@step
def b(self):
print("In B")
self.next(self.join)
@step
def join(self, inputs):
self.next(self.end)
@step
def end(self):
print("In end")
if __name__ == "__main__":
NodeSimpleTriggeredFlow()
Python Trigger (The Sender)
You can trigger this flow using the ob-events Python library. This assumes you are using Service Principals for programmatic authentication. You can get the config string for the machine user from the Outerbounds UI.
from ob_events import EventTrigger, ConfigError, TriggerError
try:
# Create the trigger instance
event_trigger = EventTrigger()
# Initialize the library with the config string from the Outerbounds UI
event_trigger.init(config_string="awssm-arn:...")
# Or you can use static API key auth:
#
# event_trigger.init_from_service_principal(
# service_principal_name="some-static-key-principal",
# deployment_domain="mycompany.obp.outerbounds.com",
# perimeter="default",
# jwt_token="...key goes here..."
# )
# Trigger the event (name must match what's in @trigger decorator)
print("Triggering event 'my_event'...")
event_trigger.trigger("my_event", payload={"foo": "bar", "source": "my-service"})
print("Event triggered successfully!")
# You can reuse the same trigger for multiple events
event_trigger.trigger("another_event", payload={"data": "value"})
except ConfigError as e:
print(f"Configuration error: {e}")
except TriggerError as e:
print(f"Trigger error: {e}")
except ImportError as e:
print(f"Dependency error: {e}")
print("If using AWS Secrets Manager, please run 'pip install ob-events[aws]'")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ob_events-0.2.0.tar.gz.
File metadata
- Download URL: ob_events-0.2.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9879ad2650513f8b3bc78f1af89032e2f73665af390f341dad04cb1bf1b4859d
|
|
| MD5 |
db81f6503918e521e20188edb5d3d663
|
|
| BLAKE2b-256 |
6f1e8721eb50523d8925e61bf04d18e471901fe042719549c66247eda22669f5
|
Provenance
The following attestation bundles were made for ob_events-0.2.0.tar.gz:
Publisher:
publish_ob_events.yml on outerbounds/obp-foundation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ob_events-0.2.0.tar.gz -
Subject digest:
9879ad2650513f8b3bc78f1af89032e2f73665af390f341dad04cb1bf1b4859d - Sigstore transparency entry: 696964857
- Sigstore integration time:
-
Permalink:
outerbounds/obp-foundation@ed0fde5a6689bc0e8edbe98515cd6196dc264249 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/outerbounds
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_ob_events.yml@ed0fde5a6689bc0e8edbe98515cd6196dc264249 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ob_events-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ob_events-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f9fae303a1209a06541bb789c159400f868949a1a045f523654a44956a07b17
|
|
| MD5 |
9f241fd40d9413f618bca1ada3836ea5
|
|
| BLAKE2b-256 |
4d561c43dc9251ac9c03a3d0093551a7b568b5c5f4ca093815c6fbca7567c5d8
|
Provenance
The following attestation bundles were made for ob_events-0.2.0-py3-none-any.whl:
Publisher:
publish_ob_events.yml on outerbounds/obp-foundation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ob_events-0.2.0-py3-none-any.whl -
Subject digest:
1f9fae303a1209a06541bb789c159400f868949a1a045f523654a44956a07b17 - Sigstore transparency entry: 696964859
- Sigstore integration time:
-
Permalink:
outerbounds/obp-foundation@ed0fde5a6689bc0e8edbe98515cd6196dc264249 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/outerbounds
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_ob_events.yml@ed0fde5a6689bc0e8edbe98515cd6196dc264249 -
Trigger Event:
workflow_dispatch
-
Statement type: