This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

automations

Classes

class Automation: A local instance of a saved W&B automation.

class DoNothing: Defines an automation action that intentionally does nothing.

class MetricChangeFilter: Defines a filter that compares a change in a run metric against a user-defined threshold.

class MetricThresholdFilter: Defines a filter that compares a run metric against a user-defined threshold value.

class NewAutomation: A new automation to be created.

class OnAddArtifactAlias: A new alias is assigned to an artifact.

class OnCreateArtifact: A new artifact is created.

class OnLinkArtifact: A new artifact is linked to a collection.

class OnRunMetric: A run metric satisfies a user-defined condition.

class SendNotification: Defines an automation action that sends a (Slack) notification.

class SendWebhook: Defines an automation action that sends a webhook request.

1 - Automation

A local instance of a saved W&B automation.

Attributes
name The name of this automation.
description An optional description of this automation.
enabled Whether this automation is enabled. Only enabled automations will trigger.
scope The scope in which the triggering event must occur.
event The event that will trigger this automation.
action The action that will execute when this automation is triggered.

2 - DoNothing

Defines an automation action that intentionally does nothing.

Attributes
no_op Placeholder field which exists only to satisfy backend schema requirements. There should never be a need to set this field explicitly, as its value is ignored.
action_type The kind of action to be triggered.

3 - MetricChangeFilter

Defines a filter that compares a change in a run metric against a user-defined threshold.

The change is calculated over “tumbling” windows, i.e. the difference between the current window and the non-overlapping prior window.

Attributes
prior_window Size of the prior window over which the metric is aggregated (ignored if agg is None). If omitted, defaults to the size of the current window.
name Name of the observed metric.
agg Aggregate operation, if any, to apply over the window size.
window Size of the window over which the metric is aggregated (ignored if agg is None).
threshold Threshold value to compare against.

4 - MetricThresholdFilter

Defines a filter that compares a run metric against a user-defined threshold value.

Attributes
cmp Comparison operator used to compare the metric value (left) vs. the threshold value (right).
name Name of the observed metric.
agg Aggregate operation, if any, to apply over the window size.
window Size of the window over which the metric is aggregated (ignored if agg is None).
threshold Threshold value to compare against.

5 - NewAutomation

A new automation to be created.

Attributes
name The name of this automation.
description An optional description of this automation.
enabled Whether this automation is enabled. Only enabled automations will trigger.
event The event that will trigger this automation.
action The action that will execute when this automation is triggered.
scope The scope in which the triggering event must occur.

6 - OnAddArtifactAlias

A new alias is assigned to an artifact.

Attributes
scope The scope of the event.
filter Additional condition(s), if any, that must be met for this event to trigger an automation.

Methods

then

View source

then(
    action: InputAction
) -> NewAutomation
Python

Define a new Automation in which this event triggers the given action.

7 - OnCreateArtifact

A new artifact is created.

Attributes
scope The scope of the event: only artifact collections are valid scopes for this event.
filter Additional condition(s), if any, that must be met for this event to trigger an automation.

Methods

then

View source

then(
    action: InputAction
) -> NewAutomation
Python

Define a new Automation in which this event triggers the given action.

8 - OnLinkArtifact

A new artifact is linked to a collection.

Attributes
scope The scope of the event.
filter Additional condition(s), if any, that must be met for this event to trigger an automation.

Methods

then

View source

then(
    action: InputAction
) -> NewAutomation
Python

Define a new Automation in which this event triggers the given action.

9 - OnRunMetric

A run metric satisfies a user-defined condition.

Attributes
scope The scope of the event: only projects are valid scopes for this event.
filter Run and/or metric condition(s) that must be satisfied for this event to trigger an automation.

Methods

then

View source

then(
    action: InputAction
) -> NewAutomation
Python

Define a new Automation in which this event triggers the given action.

10 - SendNotification

Defines an automation action that sends a (Slack) notification.

Attributes
title The title of the sent notification.
message The message body of the sent notification.
severity The severity (INFO, WARN, ERROR) of the sent notification.
action_type The kind of action to be triggered.

Methods

from_integration

View source

@classmethod
from_integration(
    integration: SlackIntegration,
    *,
    title: str = "",
    text: str = "",
    level: AlertSeverity = AlertSeverity.INFO
) -> Self
Python

Define a notification action that sends to the given (Slack) integration.

11 - SendWebhook

Defines an automation action that sends a webhook request.

Attributes
request_payload The payload, possibly with template variables, to send in the webhook request.
action_type The kind of action to be triggered.

Methods

from_integration

View source

@classmethod
from_integration(
    integration: WebhookIntegration,
    *,
    payload: Optional[SerializedToJson[dict[str, Any]]] = None
) -> Self
Python

Define a webhook action that sends to the given (webhook) integration.