Add workflow for user-abi-triggered decoded traces history (#982)

* add workflow

* format

* delete req

* change timing

* use 1 workflow

* name

* add to csv

* name

* name

* delete
This commit is contained in:
Sam 2024-11-20 10:55:39 +08:00 committed by GitHub
parent 65feb9ff48
commit 7e9c2d527d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 43 additions and 40 deletions

View File

@ -1,5 +1,5 @@
name: dbt_run_scheduled_decoded_logs_history_user_abis
run-name: dbt_run_scheduled_decoded_logs_history_user_abis
name: dbt_run_scheduled_decoded_history_user_abis
run-name: dbt_run_scheduled_decoded_history_user_abis
on:
workflow_dispatch:
@ -40,6 +40,6 @@ jobs:
pip install -r requirements.txt
dbt deps
- name: Kick off decoded logs history, if there are new ABIs from users
- name: Kick off decoded history, if there are new ABIs from users
run: |
dbt run-operation run_decoded_logs_history
dbt run-operation run_decoded_history

View File

@ -3,9 +3,8 @@ run-name: dbt_run_streamline_decoded_traces_history
on:
workflow_dispatch:
schedule:
# Runs “At 22:05 every Saturday.” (see https://crontab.guru)
- cron: '5 22 * * 6'
branches:
- "main"
env:
DBT_PROFILES_DIR: ./
@ -46,5 +45,3 @@ jobs:
- name: Decode historical traces
run: |
dbt run-operation decoded_traces_history --args '{"backfill_mode": false}' --vars '{"STREAMLINE_INVOKE_STREAMS":True}'

View File

@ -8,4 +8,5 @@ dbt_run_streamline_beacon,"55 */1 * * *"
dbt_test_tasks,"0 * * * *"
dbt_test_intraday,"34 */4 * * *"
dbt_run_streamline_decoded_logs_history,"42 9 * * 6"
dbt_run_scheduled_decoded_logs_history_user_abis,"46 23 * * *"
dbt_run_streamline_decoded_traces_history,"5 22 * * 6"
dbt_run_scheduled_decoded_history_user_abis,"46 23 * * *"

1 workflow_name workflow_schedule
8 dbt_test_tasks 0 * * * *
9 dbt_test_intraday 34 */4 * * *
10 dbt_run_streamline_decoded_logs_history 42 9 * * 6
11 dbt_run_scheduled_decoded_logs_history_user_abis dbt_run_streamline_decoded_traces_history 46 23 * * * 5 22 * * 6
12 dbt_run_scheduled_decoded_history_user_abis 46 23 * * *

View File

@ -19,7 +19,7 @@
) } -%}
{% set wait_time = var(
"DECODED_TRACES_HISTORY_WAIT_TIME",
60
180
) %}
{% set find_months_query %}
WITH base AS (

View File

@ -0,0 +1,34 @@
{% macro run_decoded_history() %}
{% set check_for_new_user_abis_query %}
SELECT
1
FROM
{{ ref('silver__user_verified_abis') }}
WHERE
_inserted_timestamp :: DATE = SYSDATE() :: DATE
AND DAYNAME(SYSDATE()) <> 'Sat' {% endset %}
{% set results = run_query(check_for_new_user_abis_query) %}
{% if execute %}
{% set new_user_abis = results.columns [0].values() [0] %}
{% if new_user_abis %}
{% set invoke_logs_query %}
SELECT
github_actions.workflow_dispatches(
'FlipsideCrypto',
'ethereum-models',
'dbt_run_streamline_decoded_logs_history.yml',
NULL
) {% endset %}
{% set invoke_traces_query %}
SELECT
github_actions.workflow_dispatches(
'FlipsideCrypto',
'ethereum-models',
'dbt_run_streamline_decoded_traces_history.yml',
NULL
) {% endset %}
{% do run_query(invoke_logs_query) %}
{% do run_query(invoke_traces_query) %}
{% endif %}
{% endif %}
{% endmacro %}

View File

@ -1,29 +0,0 @@
{% macro run_decoded_logs_history() %}
{% set check_for_new_user_abis_query %}
select 1
from {{ ref('silver__user_verified_abis') }}
where _inserted_timestamp::date = sysdate()::date
and dayname(sysdate()) <> 'Sat'
{% endset %}
{% set results = run_query(check_for_new_user_abis_query) %}
{% if execute %}
{% set new_user_abis = results.columns[0].values()[0] %}
{% if new_user_abis %}
{% set invoke_workflow_query %}
SELECT
github_actions.workflow_dispatches(
'FlipsideCrypto',
'ethereum-models',
'dbt_run_streamline_decoded_logs_history.yml',
NULL
)
{% endset %}
{% do run_query(invoke_workflow_query) %}
{% endif %}
{% endif %}
{% endmacro %}