# orca.schedule

> A module of Orca's API.

Schedules: when a pipeline runs by itself, and which partition it fills.

```mojo
comptime Taxi = Pipeline[
    "taxi", Download, Load, Compact,
    partitions=Monthly["2011-01"],
    schedule=Cron["0 3 2 * *", "America/New_York"],  # 03:00 on the 2nd
    fills=Previous,                                   # last month
]
```

A fire at some time fills the partition the time falls in on the schedule's
wall clock (`Current`), or the one before it (`Previous`, the default): a
monthly load that runs on the 2nd loads the month that just ended.
`catchup=False` tells the scheduler to start only the latest of the fires it
missed while it was down. The scheduler itself is phase 2's next PR; until
then a schedule is declared, checked, and shown by `describe` and `fires`.

## Structs

### `Fill`

```mojo
struct Fill
```

Which partition a fire fills.

Implements: `Copyable`, `Equatable`, `ImplicitlyCopyable`, `Movable`, `RegisterPassable`, `TrivialRegisterPassable`, `Writable`

Fields:

- `value: Int`

#### `__eq__`

```mojo
def __eq__(self, other: Self) -> Bool
```

#### `write_to`

```mojo
def write_to(self, mut writer: T)
```

### `NoSchedule`

```mojo
struct NoSchedule
```

Runs only when started by hand or by a backfill.

Implements: `Movable`, `ScheduleLike`

#### `expr`

```mojo
def expr() -> StaticString
```

#### `zone`

```mojo
def zone() -> StaticString
```

### `Cron`

```mojo
struct Cron[cron: StringSpan[ImmStaticOrigin], tz: StringSpan[ImmStaticOrigin] = StringSpan("UTC")]
```

Fires when `cron` matches on the wall clock of time zone `tz`.

Implements: `Movable`, `ScheduleLike`

#### `expr`

```mojo
def expr() -> StaticString
```

#### `zone`

```mojo
def zone() -> StaticString
```

### `Schedule`

```mojo
struct Schedule
```

A pipeline's schedule, parsed and with its zone loaded.

Implements: `Copyable`, `Movable`

Fields:

- `cron: CronExpr`
- `zone: Zone`

#### `of`

```mojo
def of[S: ScheduleLike]() -> Self
```

#### `next_fire`

```mojo
def next_fire(self, after: Int64) -> Int64
```

## Traits

### `ScheduleLike`

```mojo
undefined
```

#### `expr`

```mojo
def expr() -> StaticString
```

The cron expression; empty for no schedule.

#### `zone`

```mojo
def zone() -> StaticString
```

The time zone's name, such as `America/New_York`.

## Aliases

### `Previous`

```mojo
comptime Previous = Fill(Int(0))
```

The partition before the one the fire's time falls in.

### `Current`

```mojo
comptime Current = Fill(Int(1))
```

The partition the fire's time falls in.
