> ## 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)

## 클래스 wandb.automations.OnSandboxState

샌드박스가 생성되거나, 완료되거나, 실패할 때 발생합니다.

정상적으로 종료되거나 중지된 샌드박스는 완료 상태가 됩니다.
시작에 실패하거나, 오류로 종료되거나, 최대 수명에 도달한 샌드박스는 실패 상태가 됩니다.

```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')]
```

## 인수

**event\_type** `Literal`

설명이 제공되지 않았습니다.

**scope** `Annotated`

이벤트의 범위입니다. 프로젝트 하나를 지정하거나, 팀을 지정하여 해당 팀의 모든 프로젝트를 포함할 수 있습니다.

이 이벤트는 샌드박스가 생성된 프로젝트를 기준으로 샌드박스를 매칭하므로
조직 범위는 지원되지 않습니다.

**filter** `Annotated`

이 이벤트가 트리거되려면 충족해야 하는 샌드박스 상태 조건입니다.

## 예시

프로젝트
"my-project"에서 생성된 모든 샌드박스가 완료되거나 실패하면 트리거되는 이벤트를 정의합니다.

```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"]),
)
```
