Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 175 additions & 33 deletions models/ref/python/automations/automation.mdx
Original file line number Diff line number Diff line change
@@ -1,47 +1,189 @@
---
title: Automation
namespace: automations_namespace
python_object_type: class
kind: class
namespace: wandb.automations.automations
---

import { GitHubLink } from '/snippets/_includes/github-source-link.mdx';

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/automations/automations.py" />

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/automations/automations.py#L19" />



```python
*,
__typename: Literal['Trigger'] = 'Trigger',
id: typing.Annotated[str, Strict(strict=True)],
createdAt: datetime.datetime,
updatedAt: Optional[datetime.datetime] = None,
name: str,
description: Optional[str],
enabled: bool,
scope: Annotated[Union[wandb.automations.scopes._ArtifactSequenceScope, wandb.automations.scopes._ArtifactPortfolioScope, wandb.automations.scopes.ProjectScope], BeforeValidator(func=<function parse_scope at 0x108b82980>, json_schema_input_type=PydanticUndefined)],
event: wandb.automations.events.SavedEvent,
action: Annotated[Union[wandb.automations.actions.SavedLaunchJobAction, wandb.automations.actions.SavedNotificationAction, wandb.automations.actions.SavedWebhookAction, wandb.automations.actions.SavedNoOpAction], BeforeValidator(func=<function parse_saved_action at 0x108b828e0>, json_schema_input_type=PydanticUndefined)]
```

## Description

## <kbd>class</kbd> `Automation`
A local instance of a saved W&B automation that supports editing.


### <kbd>method</kbd> `Automation.__init__`

```python
__init__(
typename__: 'Literal['Trigger']' = 'Trigger',
id: 'str',
created_at: 'datetime',
updated_at: 'datetime | None' = None,
name: 'str',
description: 'str | None',
enabled: 'bool',
scope: '_ArtifactSequenceScope | _ArtifactPortfolioScope | ProjectScope',
event: 'SavedEvent',
action: 'SavedLaunchJobAction | SavedNotificationAction | SavedWebhookAction | SavedNoOpAction'
) → None
## Args:

- **__typename**:
- **id**:
- **createdAt**:
- **updatedAt**:
- **name**:
- **description**:
- **enabled**:
- **scope**:
- **event**:
- **action**:




## Methods:

### construct



### copy

Returns a copy of the model.

!!! warning "Deprecated"
This method is now deprecated; use `model_copy` instead.

If you need `include` or `exclude`, use:

```python {test="skip" lint="skip"}
data = self.model_dump(include=include, exclude=exclude, round_trip=True)
data = {**data, **(update or {})}
copied = self.model_validate(data)
```

**Args:**

- `typename__` (Literal['Trigger']):
- `id` (str):
- `created_at` (datetime): The date and time when this automation was created.
- `updated_at` (Optional[datetime]): The date and time when this automation was last updated, if applicable.
- `name` (str): The name of this automation.
- `description` (Optional[str]): An optional description of this automation.
- `enabled` (bool): Whether this automation is enabled. Only enabled automations will trigger.
- `scope` (Union[_ArtifactSequenceScope, _ArtifactPortfolioScope, ProjectScope]): The scope in which the triggering event must occur.
- `event` (SavedEvent): The event that will trigger this automation.
- `action` (Union[SavedLaunchJobAction, SavedNotificationAction, SavedWebhookAction, SavedNoOpAction]): The action that will execute when this automation is triggered.

**Returns:**
An `Automation` object.
### dict



### from_orm



### json



### model_construct

Creates a new instance of the `Model` class with validated data.

Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data.
Default values are respected, but no other validation is performed.

!!! note
`model_construct()` generally respects the `model_config.extra` setting on the provided model.
That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__`
and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored.
Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in
an error if extra values are passed, but they will be ignored.

### model_copy

!!! abstract "Usage Documentation"
[`model_copy`](../concepts/serialization.md#model_copy)

Returns a copy of the model.

!!! note
The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This
might have unexpected side effects if you store anything in it, on top of the model
fields (e.g. the value of [cached properties][functools.cached_property]).

### model_dump

!!! abstract "Usage Documentation"
[`model_dump`](../concepts/serialization.md#modelmodel_dump)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

### model_dump_json

!!! abstract "Usage Documentation"
[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json)

Generates a JSON representation of the model using Pydantic's `to_json` method.

### model_json_schema

Generates a JSON schema for a model class.

### model_parametrized_name

Compute the class name for parametrizations of generic classes.

This method can be overridden to achieve a custom naming scheme for generic BaseModels.

### model_post_init

Override this method to perform additional initialization after `__init__` and `model_construct`.
This is useful if you want to do some validation that requires the entire model to be initialized.

### model_rebuild

Try to rebuild the pydantic-core schema for the model.

This may be necessary when one of the annotations is a ForwardRef which could not be resolved during
the initial attempt to build the schema, and automatic rebuilding fails.

### model_validate

Validate a pydantic model instance.

### model_validate_json

!!! abstract "Usage Documentation"
[JSON Parsing](../concepts/json.md#json-parsing)

Validate the given JSON data against the Pydantic model.

### model_validate_strings

Validate the given object with string data against the Pydantic model.

### parse_file



### parse_obj



### parse_raw



### schema



### schema_json



### update_forward_refs



### validate





Loading
Loading