Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ob_events-0.2.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

ob_events-0.2.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

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

Hashes for ob_events-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9879ad2650513f8b3bc78f1af89032e2f73665af390f341dad04cb1bf1b4859d
MD5 db81f6503918e521e20188edb5d3d663
BLAKE2b-256 6f1e8721eb50523d8925e61bf04d18e471901fe042719549c66247eda22669f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ob_events-0.2.0.tar.gz:

Publisher: publish_ob_events.yml on outerbounds/obp-foundation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for ob_events-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f9fae303a1209a06541bb789c159400f868949a1a045f523654a44956a07b17
MD5 9f241fd40d9413f618bca1ada3836ea5
BLAKE2b-256 4d561c43dc9251ac9c03a3d0093551a7b568b5c5f4ca093815c6fbca7567c5d8

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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