> ## Documentation Index
> Fetch the complete documentation index at: https://elementary-devin-1782754750-bigquery-permissions-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# execution_sla

<Card title="Generate your anomaly test with Elementary AI" icon="wand-magic-sparkles" horizontal="true" href="https://elementary-data.com/community">
  Let our Slack chatbot create the anomaly test you need.
</Card>

`elementary.execution_sla`

Verifies that dbt models are executed successfully before a specified SLA deadline time.

This test checks whether your pipeline *ran* before a specified deadline on the days you care about. It queries `dbt_run_results` for successful runs of the model and validates that at least one run completed before the SLA deadline.

Note that this test only verifies that the model executed, not that the data is actually fresh. If you need to verify that the underlying data was updated (e.g., an upstream source refreshed), use [`data_freshness_sla`](/data-tests/data-freshness-sla) instead.

### Use Case

"Did my pipeline complete before 7 AM Pacific on the days I care about?"

### Test Logic

1. If today is not a scheduled check day → **PASS** (skip)
2. Query `dbt_run_results` for successful runs of the model today
3. If any run completed before the SLA deadline → **PASS**
4. If SLA deadline hasn't passed yet → **PASS** (still time)
5. If model ran but after deadline → **FAIL** (MISSED\_SLA)
6. If all runs failed → **FAIL** (ALL\_FAILED)
7. If model didn't run today → **FAIL** (NOT\_RUN)

### Test configuration

*Required configuration: `sla_time`, `timezone`*

<pre>
  <code>
    data\_tests:
      -- elementary.execution\_sla:
        arguments:
          <font color="#CD7D55">sla\_time: string</font> # Required - e.g., "07:00", "7am", "2:30pm", "14:30"
          <font color="#CD7D55">timezone: string</font> # Required - IANA timezone name, e.g., "America/Los\_Angeles", "Europe/Amsterdam"
          <font color="#CD7D55">day\_of\_week: string | array</font> # Optional - Day(s) to check: "Monday" or \["Monday", "Wednesday"]
          <font color="#CD7D55">day\_of\_month: int | array</font> # Optional - Day(s) of month to check: 1 or \[1, 15]
  </code>
</pre>

<RequestExample>
  ```yml Models theme={null}
  models:
    - name: < model name >
      data_tests:
        - elementary.execution_sla:
            arguments:
              sla_time: < deadline time > # Required - e.g., "07:00", "7am", "2:30pm"
              timezone: < IANA timezone > # Required - e.g., "America/Los_Angeles"
              day_of_week: < day or array > # Optional
              day_of_month: < day or array > # Optional
  ```

  ```yml Daily check (default) theme={null}
  models:
    - name: daily_revenue
      data_tests:
        - elementary.execution_sla:
            arguments:
              sla_time: "07:00"
              timezone: "America/Los_Angeles"
            config:
              tags: ["elementary"]
              severity: error
  ```

  ```yml Weekly - only Mondays and Wednesdays theme={null}
  models:
    - name: weekly_report
      data_tests:
        - elementary.execution_sla:
            arguments:
              sla_time: "06:00"
              timezone: "Europe/London"
              day_of_week: ["Monday", "Wednesday"]
            config:
              tags: ["elementary"]
  ```

  ```yml Monthly - only 1st and 15th theme={null}
  models:
    - name: monthly_close
      data_tests:
        - elementary.execution_sla:
            arguments:
              sla_time: "09:00"
              timezone: "Asia/Tokyo"
              day_of_month: [1, 15]
            config:
              tags: ["elementary"]
  ```
</RequestExample>

### Features

* **Flexible time formats**: Supports `"07:00"`, `"7am"`, `"2:30pm"`, `"14:30"`, and other common formats
* **IANA timezone support**: Uses standard timezone names like `"America/Los_Angeles"`, `"Europe/Amsterdam"`, etc.
* **Automatic DST handling**: Uses `pytz` for timezone conversions with automatic daylight saving time handling
* **Database-agnostic**: All timezone logic happens at compile time
* **Schedule filters**: Optional `day_of_week` and `day_of_month` parameters to check only specific days

### Parameters

| Parameter      | Required | Description                                              |
| -------------- | -------- | -------------------------------------------------------- |
| `sla_time`     | Yes      | Deadline time (e.g., `"07:00"`, `"7am"`, `"2:30pm"`)     |
| `timezone`     | Yes      | IANA timezone name (e.g., `"America/Los_Angeles"`)       |
| `day_of_week`  | No       | Day(s) to check: `"Monday"` or `["Monday", "Wednesday"]` |
| `day_of_month` | No       | Day(s) of month to check: `1` or `[1, 15]`               |

### Notes

* This test only works with **models**, not sources
* The test automatically skips on non-scheduled days (when `day_of_week` or `day_of_month` filters are set)
* If both `day_of_week` and `day_of_month` are set, the test uses OR logic (checks if either matches)
* The test passes if the SLA deadline hasn't been reached yet, giving your pipeline time to complete
