Skip to content

Commit

Permalink
LQ (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinFlipside committed Nov 1, 2023
1 parent 6c579ac commit cb91ce2
Show file tree
Hide file tree
Showing 24 changed files with 148 additions and 24 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/dbt_alter_gha_task.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_abi_refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run -m tag:abis
dbt run -m "base_models,tag:abis"


2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_full_observability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run --threads 2 --vars '{"OBSERV_FULL_TEST":True}' -m tag:observability
dbt run --threads 2 --vars '{"OBSERV_FULL_TEST":True}' -m "base_models,tag:observability"


2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_heal_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run -m tag:heal --var '{"HEAL_MODEL":True}'
dbt run -m "base_models,tag:heal" --var '{"HEAL_MODEL":True}'
2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_operation_reorg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: List reorg models
id: list_models
run: |
reorg_model_list=$(dbt list --select tag:reorg --resource-type model | awk -F'.' '{print $NF}' | tr '\n' ',' | sed 's/,$//')
reorg_model_list=$(dbt list --select "base_models,tag:reorg" --resource-type model | awk -F'.' '{print $NF}' | tr '\n' ',' | sed 's/,$//')
echo "::set-output name=model_list::$reorg_model_list"
- name: Execute block_reorg macro
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/dbt_run_scheduled_non_realtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ run-name: dbt_run_scheduled_non_realtime

on:
workflow_dispatch:
schedule:
# Runs at minutes 15 and 45 (see https://crontab.guru)
- cron: '15,45 * * * *'
branches:
- "main"

env:
DBT_PROFILES_DIR: ./
Expand Down Expand Up @@ -42,4 +41,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m tag:non_realtime tag:streamline_decoded_logs_complete tag:streamline_decoded_logs_realtime
dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "base_models,tag:non_realtime" "base_models,tag:streamline_decoded_logs_complete" "base_models,tag:streamline_decoded_logs_realtime"
7 changes: 3 additions & 4 deletions .github/workflows/dbt_run_streamline_chainhead.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ run-name: dbt_run_streamline_chainhead

on:
workflow_dispatch:
schedule:
# Runs at minutes 5 and 35 (see https://crontab.guru)
- cron: '5,35 * * * *'
branches:
- "main"

env:
DBT_PROFILES_DIR: ./
Expand Down Expand Up @@ -42,4 +41,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m tag:streamline_core_complete tag:streamline_core_realtime
dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "base_models,tag:streamline_core_complete" "base_models,tag:streamline_core_realtime"
7 changes: 3 additions & 4 deletions .github/workflows/dbt_run_streamline_decoder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ run-name: dbt_run_streamline_decoder

on:
workflow_dispatch:
schedule:
# Runs at minutes 25 and 55 (see https://crontab.guru)
- cron: '25,55 * * * *'
branches:
- "main"

env:
DBT_PROFILES_DIR: ./
Expand Down Expand Up @@ -42,4 +41,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run -m tag:decoded_logs
dbt run -m "base_models,tag:decoded_logs"
2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_streamline_decoder_history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True,"WAIT":120}' -m tag:streamline_decoded_logs_complete tag:streamline_decoded_logs_history
dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True,"WAIT":120}' -m "base_models,tag:streamline_decoded_logs_complete" "base_models,tag:streamline_decoded_logs_history"
2 changes: 1 addition & 1 deletion .github/workflows/dbt_run_streamline_history_adhoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
description: 'DBT Run Command'
required: true
options:
- dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True,"WAIT":120}' -m tag:streamline_decoded_logs_complete tag:streamline_decoded_logs_history
- dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True,"WAIT":120}' -m "base_models,tag:streamline_decoded_logs_complete" "base_models,tag:streamline_decoded_logs_history"

env:
DBT_PROFILES_DIR: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dbt_test_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt test --exclude tag:full_test tag:recent_test tag:base_goerli
dbt test --exclude "base_models,tag:full_test" "base_models,tag:recent_test" "base_models,tag:base_goerli" "base_models,tag:gha_tasks" livequery_models


4 changes: 2 additions & 2 deletions .github/workflows/dbt_test_intraday.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run -m tag:observability
dbt test -m tag:recent_test
dbt run -m "base_models,tag:observability"
dbt test -m "base_models,tag:recent_test"


2 changes: 1 addition & 1 deletion .github/workflows/dbt_test_monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt test -m tag:full_test
dbt test -m "base_models,tag:full_test"


27 changes: 27 additions & 0 deletions .github/workflows/dbt_test_tasks.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions data/github_actions__workflows.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
workflow_name,workflow_schedule
dbt_run_scheduled_non_realtime,"15,45 * * * *"
dbt_run_streamline_chainhead,"5,35 * * * *"
dbt_run_streamline_decoder,"25,55 * * * *"
dbt_test_tasks,"15,45 * * * *"
3 changes: 2 additions & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ vars:
UPDATE_SNOWFLAKE_TAGS: True
OBSERV_FULL_TEST: False
WAIT: 0
HEAL_MODEL: False
HEAL_MODEL: False
START_GHA_TASKS: False
6 changes: 6 additions & 0 deletions models/github_actions/github_actions__current_task_status.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ config(
materialized = 'view',
tags = ['gha_tasks']
) }}

{{ fsc_utils.gha_task_current_status_view() }}
17 changes: 17 additions & 0 deletions models/github_actions/github_actions__current_task_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
models:
- name: github_actions__current_task_status
columns:
- name: WAS_SUCCESSFUL
tests:
- dbt_expectations.expect_column_values_to_be_in_set:
value_set:
- TRUE
- name: RETURN_VALUE
tests:
- dbt_expectations.expect_column_values_to_be_in_set:
value_set:
- 204
config:
severity: warn
warn_if: ">0"
5 changes: 5 additions & 0 deletions models/github_actions/github_actions__task_history.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}

{{ fsc_utils.gha_task_history_view() }}
5 changes: 5 additions & 0 deletions models/github_actions/github_actions__task_performance.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}

{{ fsc_utils.gha_task_performance_view() }}
5 changes: 5 additions & 0 deletions models/github_actions/github_actions__task_schedule.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}

{{ fsc_utils.gha_task_schedule_view() }}
5 changes: 5 additions & 0 deletions models/github_actions/github_actions__tasks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ config(
materialized = 'view'
) }}

{{ fsc_utils.gha_tasks_view() }}
5 changes: 5 additions & 0 deletions models/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ sources:
schema: bronze_api
tables:
- name: contract_abis
- name: github_actions
database: base
schema: github_actions
tables:
- name: workflows
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ packages:
- package: dbt-labs/dbt_utils
version: 1.0.0
- git: https://github.com/FlipsideCrypto/fsc-utils.git
revision: v1.6.2
revision: v1.9.3
- package: get-select/dbt_snowflake_query_tags
version: [">=2.0.0", "<3.0.0"]

0 comments on commit cb91ce2

Please sign in to comment.