diff --git a/.github/workflows/dbt_run_scheduled_decoded_logs_history_user_abis.yml b/.github/workflows/dbt_run_scheduled_decoded_history_user_abis.yml similarity index 75% rename from .github/workflows/dbt_run_scheduled_decoded_logs_history_user_abis.yml rename to .github/workflows/dbt_run_scheduled_decoded_history_user_abis.yml index 63bf5a25..71339eb8 100644 --- a/.github/workflows/dbt_run_scheduled_decoded_logs_history_user_abis.yml +++ b/.github/workflows/dbt_run_scheduled_decoded_history_user_abis.yml @@ -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 \ No newline at end of file + dbt run-operation run_decoded_history diff --git a/.github/workflows/dbt_run_streamline_decoded_traces_history.yml b/.github/workflows/dbt_run_streamline_decoded_traces_history.yml index 01984c5f..7e324a3f 100644 --- a/.github/workflows/dbt_run_streamline_decoded_traces_history.yml +++ b/.github/workflows/dbt_run_streamline_decoded_traces_history.yml @@ -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}' - - diff --git a/data/github_actions__workflows.csv b/data/github_actions__workflows.csv index a82ba0c4..9ff7fee9 100644 --- a/data/github_actions__workflows.csv +++ b/data/github_actions__workflows.csv @@ -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 * * *" diff --git a/macros/streamline/decoded_traces_history.sql b/macros/decoder/decoded_traces_history.sql similarity index 99% rename from macros/streamline/decoded_traces_history.sql rename to macros/decoder/decoded_traces_history.sql index 633920c3..b59d6b71 100644 --- a/macros/streamline/decoded_traces_history.sql +++ b/macros/decoder/decoded_traces_history.sql @@ -19,7 +19,7 @@ ) } -%} {% set wait_time = var( "DECODED_TRACES_HISTORY_WAIT_TIME", - 60 + 180 ) %} {% set find_months_query %} WITH base AS ( diff --git a/macros/decoder/run_decoded_history.sql b/macros/decoder/run_decoded_history.sql new file mode 100644 index 00000000..8d148639 --- /dev/null +++ b/macros/decoder/run_decoded_history.sql @@ -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 %} diff --git a/macros/decoder/run_decoded_logs_history.sql b/macros/decoder/run_decoded_logs_history.sql deleted file mode 100644 index 49f2fd07..00000000 --- a/macros/decoder/run_decoded_logs_history.sql +++ /dev/null @@ -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 %} \ No newline at end of file