gha tasks

This commit is contained in:
Eric Laurello 2023-11-06 14:07:03 -05:00
parent c1596dcdd2
commit 60656ddfd7
16 changed files with 139 additions and 12 deletions

View File

@ -0,0 +1,46 @@
name: dbt_alter_gha_task
run-name: dbt_alter_gha_task
on:
workflow_dispatch:
branches:
- "main"
inputs:
workflow_name:
type: string
description: Name of the workflow to perform the action on, no .yml extension
required: true
task_action:
type: choice
description: Action to perform
required: true
options:
- SUSPEND
- RESUME
default: SUSPEND
env:
DBT_PROFILES_DIR: ./
ACCOUNT: "${{ vars.ACCOUNT }}"
ROLE: "${{ vars.ROLE }}"
USER: "${{ vars.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ vars.REGION }}"
DATABASE: "${{ vars.DATABASE }}"
WAREHOUSE: "${{ vars.WAREHOUSE }}"
SCHEMA: "${{ vars.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
called_workflow_template:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_alter_gha_tasks.yml@main
with:
workflow_name: |
${{ inputs.workflow_name }}
task_action: |
${{ inputs.task_action }}
environment: workflow_prod
secrets: inherit

View File

@ -1,11 +1,11 @@
name: dbt_run_scheduled
run-name: dbt_run_scheduled
name: dbt_run_incremental
run-name: dbt_run_incremental
on:
workflow_dispatch:
schedule:
# Runs "every hour at the 45 minute" (see https://crontab.guru)
- cron: '25,55 */1 * * *'
# schedule:
# # Runs "every hour at the 45 minute" (see https://crontab.guru)
# - cron: '25,55 * * * *'
env:
USE_VARS: "${{ vars.USE_VARS }}"
@ -28,7 +28,7 @@ jobs:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_run_template.yml@main
with:
dbt_command: |
dbt run -s ./models --exclude models/streamline models/silver/_observability;
dbt run -m models/bronze models/silver models/gold --exclude models/streamline models/silver/_observability;
dbt run -m models/bronze/bronze_api/bronze_api__get_blockchain_api.sql;
dbt run -m models/silver/core/silver__blockchain.sql;
environment: workflow_prod

View File

@ -7,9 +7,9 @@ on:
branches:
# - main
- turn-off-dev-turn-on-prod
schedule:
# Runs "every hour at the 0 minute" (see https://crontab.guru)
- cron: '0,30 */1 * * *'
# schedule:
# # Runs "every hour at the 0 minute" (see https://crontab.guru)
# - cron: '0,30 * * * *'
env:
USE_VARS: "${{ vars.USE_VARS }}"

View File

@ -27,7 +27,7 @@ jobs:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_run_template.yml@main
with:
dbt_command: |
dbt test -m ./models
dbt test -m models/bronze models/silver models/gold
environment: workflow_prod
warehouse: ${{ vars.WAREHOUSE }}
secrets: inherit

27
.github/workflows/dbt_test_tasks.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: dbt_test_tasks
run-name: dbt_test_tasks
on:
workflow_dispatch:
branches:
- "main"
env:
DBT_PROFILES_DIR: ./
ACCOUNT: "${{ vars.ACCOUNT }}"
ROLE: "${{ vars.ROLE }}"
USER: "${{ vars.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ vars.REGION }}"
DATABASE: "${{ vars.DATABASE }}"
WAREHOUSE: "${{ vars.WAREHOUSE }}"
SCHEMA: "${{ vars.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
called_workflow_template:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_test_tasks.yml@main
secrets: inherit

View File

@ -0,0 +1,4 @@
workflow_name,workflow_schedule
dbt_run_incremental,"25,55 * * * *"
dbt_run_streamline,"0,30 * * * *"
dbt_test_tasks,"0,30 * * * *"
1 workflow_name workflow_schedule
2 dbt_run_incremental 25,55 * * * *
3 dbt_run_streamline 0,30 * * * *
4 dbt_test_tasks 0,30 * * * *

View File

@ -46,6 +46,7 @@ vars:
STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False
"UPDATE_SNOWFLAKE_TAGS": True
OBSERV_FULL_TEST: False
START_GHA_TASKS: False
dispatch:
- macro_namespace: dbt

View File

@ -0,0 +1,6 @@
{{ config(
materialized = 'view',
tags = ['gha_tasks']
) }}
{{ fsc_utils.gha_task_current_status_view() }}

View File

@ -0,0 +1,17 @@
version: 2
models:
- name: github_actions__current_task_status
columns:
- name: PIPELINE_ACTIVE
tests:
- dbt_expectations.expect_column_values_to_be_in_set:
value_set:
- TRUE
- name: SUCCESSES
tests:
- dbt_expectations.expect_column_values_to_be_in_set:
value_set:
- 204
config:
severity: warn
warn_if: ">0"

View File

@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}
{{ fsc_utils.gha_task_history_view() }}

View File

@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}
{{ fsc_utils.gha_task_performance_view() }}

View File

@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}
{{ fsc_utils.gha_task_schedule_view() }}

View File

@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}
{{ fsc_utils.gha_tasks_view() }}

View File

@ -127,4 +127,9 @@ sources:
database: base
schema: core
tables:
- name: dim_contracts
- name: dim_contracts
- name: github_actions
database: axelar
schema: github_actions
tables:
- name: workflows

View File

@ -6,6 +6,6 @@ packages:
- package: dbt-labs/dbt_utils
version: [">=1.0.0", "<1.1.0"]
- git: https://github.com/FlipsideCrypto/fsc-utils.git
revision: "v1.3.0"
revision: "v1.11.0"
- package: get-select/dbt_snowflake_query_tags
version: [">=2.0.0", "<3.0.0"]

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
dbt-snowflake>=1.4,<1.5