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

イベントのスコープです。project を指定するか、チーム内のすべての project を対象にする場合はチームを指定します。

このイベントは、サンドボックスが作成された project に基づいてサンドボックスを照合するため、
組織スコープはサポートされていません。

**filter** `Annotated`

このイベントがトリガーされるために満たす必要がある、サンドボックスの状態に関する条件です。

## サンプル

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