Skip to main content

class OnRunMetric

*,
event_type: Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE, RUN_METRIC_ZSCORE],
scope: wandb.automations.scopes.ProjectScope,
filter: typing.Annotated[wandb.automations.events.RunMetricFilter, Json, BeforeValidator(func=<function ensure_json>, json_schema_input_type=PydanticUndefined), PlainSerializer(func=<function to_json>, return_type=PydanticUndefined, when_used='always')]

Description

A run metric satisfies a user-defined condition.

Args

  • event_type:
  • scope: The scope of the event: must be a project.
  • filter: Run and/or metric condition(s) that must be satisfied for this event to trigger.

Examples

Define an event that triggers for any run in project “my-project” when the average of the last 5 values of metric “my-metric” exceeds 123.45:
from wandb import Api
from wandb.automations import OnRunMetric, RunEvent

api = Api()
project = api.project(name="my-project")

event = OnRunMetric(
    scope=project,
    filter=RunEvent.metric("my-metric").avg(5).gt(123.45),
)

Methods

method then

self,
action: 'InputAction'
Define a new Automation in which this event triggers the given action.
Arguments
  • action: