---
sidebar:
  hidden: true
title: roboto.domain.triggers.sources
---
## Module Contents

### EventSubscription

```python
class roboto.domain.triggers.sources.EventSubscription(/, **data: Any)
```

`from roboto.domain.triggers import EventSubscription`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L41-L75)

Bases: `_SourceBase`

Firing source that fires a trigger when any of its subscribed platform events occurs.

When the trigger is saved, Roboto requires at least one event type, all about the same kind of entity, such as files, and rejects [`ScheduleFired`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType.ScheduleFired); a trigger fires on a schedule by declaring a `Schedule` instead.

Constructing a subscription with a `type` other than `TriggerSourceType.Events` raises `pydantic.ValidationError`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **EventSubscription.events** (`list[roboto.domain.platform_events.PlatformEventType]`): Platform event types the trigger subscribes to.

  Its condition and target templates can read only the names, such as `dataset`, that every one of them exposes.

- **EventSubscription.once_per** (`roboto.domain.platform_events.OncePer`): What the trigger runs each target at most once for.

  [`OncePer`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer) describes the choices and which event types support each.

- **EventSubscription.type** (`Literal[TriggerSourceType]`): Kind of firing source, always `TriggerSourceType.Events`.

#### EventSubscription.fires_for()

```python
def fires_for(event_type: roboto.domain.platform_events.PlatformEventType) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L67-L75)

Return whether a platform event of `event_type` fires this subscription's trigger.

Roboto calls this when it evaluates a trigger for a platform event.

**Parameters**

- **event_type** (`roboto.domain.platform_events.PlatformEventType`): Type of the platform event.

**Returns**

- `bool`

### Schedule

```python
class roboto.domain.triggers.sources.Schedule(/, **data: Any)
```

`from roboto.domain.triggers import Schedule`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L78-L123)

Bases: `_SourceBase`

Firing source that fires a trigger on a cron schedule, in UTC.

Each scheduled minute runs the trigger's targets at most once, even when Roboto delivers that minute twice. A minute Roboto misses, such as during an outage, is skipped and never fired later, so a delayed schedule does not run its targets for past minutes. A schedule cannot name a time zone. The trigger's condition and target templates read the firing under `schedule`: `schedule.scheduled_for` is the scheduled minute and `schedule.cron` the cron expression.

Constructing a schedule with a cron expression that cannot be parsed, or with a `type` other than `TriggerSourceType.Schedule`, raises `pydantic.ValidationError`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **Schedule.cron** (`str`): Five-field cron expression (`minute hour day-of-month month day-of-week`), evaluated in UTC.

  For example, `0 9 * * 1` fires at 09:00 UTC every Monday.

- **Schedule.type** (`Literal[TriggerSourceType]`): Kind of firing source, always `TriggerSourceType.Schedule`.

**Properties**

- **Schedule.once_per** (`roboto.domain.platform_events.OncePer`): Firing limit, [`Occurrence`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer.Occurrence): once per scheduled minute.

#### Schedule.fires_for()

```python
def fires_for(event_type: roboto.domain.platform_events.PlatformEventType) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L114-L123)

Return whether a platform event of `event_type` fires this schedule's trigger.

Roboto calls this when it evaluates a trigger for a platform event. Only [`ScheduleFired`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType.ScheduleFired) fires it.

**Parameters**

- **event_type** (`roboto.domain.platform_events.PlatformEventType`): Type of the platform event.

**Returns**

- `bool`

### TriggerSource

```python
roboto.domain.triggers.sources.TriggerSource
```

`from roboto.domain.triggers import TriggerSource`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L126-L129)

Firing source of any kind: one of `EventSubscription` and `Schedule`, told apart by `type`.

A trigger has exactly one firing source.

### TriggerSourceType

```python
class roboto.domain.triggers.sources.TriggerSourceType
```

`from roboto.domain.triggers import TriggerSourceType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/sources.py#L18-L25)

Bases: `roboto.compat.StrEnum`

Kind of firing source, the `type` of each `TriggerSource`.

**Attributes**

- **TriggerSourceType.Events** = `'events'`: Subscription to platform events: the trigger fires when one of them occurs.
- **TriggerSourceType.Schedule** = `'schedule'`: Cron schedule: the trigger fires at each of its scheduled minutes.
