> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OnSandboxState

[View source](https://github.com/wandb/wandb/blob/main/wandb/automations/events.py#L460)

## Classe wandb.automations.OnSandboxState

Une sandbox est créée, se termine ou échoue.

Une sandbox se termine lorsqu’elle se ferme proprement ou qu’elle est arrêtée. Elle échoue lorsqu’elle ne parvient pas à
démarrer, qu’elle se ferme sur une erreur ou qu’elle atteint sa durée de vie maximale.

```python theme={"system"}
*,
event_type: Literal[SANDBOX_STATE] = SANDBOX_STATE,
scope: Annotated[wandb.automations.scopes.ProjectScope | wandb.automations.scopes.TeamScope, BeforeValidator(func=<function parse_scope>, json_schema_input_type=PydanticUndefined), Discriminator(discriminator='typename__', custom_error_type=None, custom_error_message=None, custom_error_context=None)],
filter: Annotated[wandb._filters.operators.And | wandb._filters.operators.Or | wandb._filters.operators.Nor | wandb._filters.operators.Not | wandb._filters.operators.Lt | wandb._filters.operators.Gt | wandb._filters.operators.Lte | wandb._filters.operators.Gte | wandb._filters.operators.Eq | wandb._filters.operators.Ne | wandb._filters.operators.In | wandb._filters.operators.NotIn | wandb._filters.operators.Exists | wandb._filters.operators.Regex | wandb._filters.operators.Contains | wandb._filters.operators.Size | wandb._filters.operators.All | wandb._filters.expressions.FilterExpr | dict[str, Any], Json, BeforeValidator(func=<function ensure_json>, json_schema_input_type=PydanticUndefined), PlainSerializer(func=<function to_json>, return_type=PydanticUndefined, when_used='always')]
```

## Arguments

**event\_type** `Literal`

Aucune description fournie.

**scope** `Annotated`

La portée de l’événement : un projet, ou une équipe pour couvrir l’ensemble de ses projets.

L’événement identifie les bacs à sable d’après le projet dans lequel ils ont été créés ; une
portée à l’échelle de l’organisation n’est donc pas prise en charge.

**filter** `Annotated`

Condition(s) sur l’état du sandbox à remplir pour que cet événement se déclenche.

## Exemples

Définissez un événement qui se déclenche pour toute sandbox créée dans le projet
"my-project" lorsqu’elle se termine ou échoue :

```python theme={"system"}
from wandb import Api
from wandb.automations import OnSandboxState, SandboxEvent

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

event = OnSandboxState(
    scope=project,
    filter=SandboxEvent.state.in_(["completed", "failed"]),
)
```
