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.1.tar.gz (26.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.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file ob_events-0.2.1.tar.gz.

File metadata

  • Download URL: ob_events-0.2.1.tar.gz
  • Upload date:
  • Size: 26.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.1.tar.gz
Algorithm Hash digest
SHA256 0e4ce33ccb98f97564307165640d47c4b6c03bccf171c61cf0c65383f666f5cb
MD5 6aa21d3cefd5134a5d389f6b3859201f
BLAKE2b-256 7466b38a4a79be639a94aba197ef489d60f85d3e0a4aed98ea72afcac36fb55a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ob_events-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: ob_events-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5747c6bdb69ef6e57e3f7d19a93920783d7761863455bb9fbf5fb67df979ea30
MD5 15975d9ddb48a7ce88813d858ea9bc0e
BLAKE2b-256 6cee36864f20e8a0632e8530d43860a1e3462f0245ff236ec398874ffc35a949

See more details on using hashes here.

Provenance

The following attestation bundles were made for ob_events-0.2.1-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