Hello <@U088WCP3B4P>! Everything was working well ...
# ask-elementary-ai
a
Hello @kapa.ai! Everything was working well for our prod elementary dashboard. We made a deployment recently the data stopped coming into the dashboard. I noticed when looking at the logs that the on-run-end hook stopped running right after the tests like usual, it just doesn't appear at all in the logs. What could be the reason ?
k
A message from kapa.ai
If the Elementary on-run-end hook has stopped appearing in your logs after a recent deployment, there are a few common reasons for this behavior based on the knowledge sources: 1. Hooks Disabled via Variables: The most frequent cause is that the on-run-end hooks have been disabled, either intentionally or accidentally, in your
dbt_project.yml
or via command-line variables. Check for any of the following variables being set to
true
or to a value that disables them for your production target:
Copy code
yaml    vars:      disable_run_results: true      disable_tests_results: true      disable_dbt_invocation_autoupload: true      disable_dbt_artifacts_autoupload: true
If any of these are set, the hooks will not run, and as a result, no data will be uploaded to the Elementary tables, leading to an empty dashboard. This is confirmed in several support threads where users saw empty reports after disabling these hooks, and re-enabling them resolved the issue [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1697549788516149)]. 2. Elementary dbt Package Not Installed or Not Enabled: If the Elementary dbt package is not installed or is disabled in your
dbt_project.yml
, the hooks will not be registered and thus will not run. Ensure that your
packages.yml
includes Elementary and that your
dbt_project.yml
enables the package for the relevant target:
Copy code
yaml    models:      elementary:        +enabled: "{{ target.name == 'prod' }}"
[[Slack thread](https://slack.com/archives/C02CTC89LAX/p1688568085309439)] 3. Profile or Target Misconfiguration: If your dbt run is using a different target or profile than expected, the hooks may not be configured to run, or they may be writing to a different schema/database. Double-check that your dbt and Elementary profiles are aligned and pointing to the correct schema/database [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1708786310140179)]. 4. Order or Failure of Other Hooks: If you have multiple on-run-end hooks and one fails before the Elementary hook, dbt will not execute subsequent hooks. This can happen if, for example, you have a custom hook that errors out, preventing Elementary from running [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1722936228529189)]. Recommended Actions: - Review your
dbt_project.yml
and deployment scripts for any of the disabling variables above. - Ensure the Elementary dbt package is installed and enabled for your production target. - Check that your dbt and Elementary profiles are correctly configured and aligned. - If you have custom hooks, verify that none are failing before the Elementary hook would run. If after these checks the hook still does not appear, try running a dbt command locally with increased log verbosity to see if any errors or warnings are being suppressed. Let me know if you need help reviewing your configuration!
a
So we indeed have the
disable_dbt_artifacts_autoupload: true
. But it seems weird to me since we always had this set to true, the deployment we made contained no change about that. Should i still set it to false ? And based on what you're saying, i should set it again to true after ? @kapa.ai
k
A message from kapa.ai
If you have always had
disable_dbt_artifacts_autoupload: true
set and your dashboard was working before, then this variable alone should only disable the automatic upload of metadata models (like
dbt_models
,
dbt_tests
, etc.), but not the upload of run results or test results. The dashboard should still show test results and run results as long as the other related variables are not set to
true
[[on-run-end hooks documentation](https://docs.elementary-data.com/dbt/on-run-end_hooks#can-i-disable-the-on-run-end-hooks%3F)]. You do not need to set
disable_dbt_artifacts_autoupload
to
false
unless you want to re-enable the automatic upload of metadata models. If your dashboard relies on these metadata models being up-to-date, then yes, you should set it to
false
(or remove the variable) and see if the on-run-end hook resumes. If you only want to upload artifacts manually (for example, after deployments), you can keep it as
true
and run:
Copy code
dbt run --select elementary.edr.dbt_artifacts
after each deployment to update the metadata [[on-run-end hooks documentation](https://docs.elementary-data.com/dbt/on-run-end_hooks)]. However, if nothing changed in your configuration and the dashboard suddenly stopped updating, it suggests something else may have changed in your environment or deployment process. Double-check that: - No other disabling variables (like
disable_run_results
,
disable_tests_results
, or
disable_dbt_invocation_autoupload
) were added or changed. - The Elementary dbt package is still installed and enabled. - The dbt run is using the expected target/profile. In summary: - You do not have to set
disable_dbt_artifacts_autoupload
to
false
unless you want to re-enable automatic metadata uploads. - If you want to keep it
true
, make sure to manually update artifacts as needed. - If your dashboard needs the metadata to be current and you want it to update automatically, set it to
false
. If the issue persists even though your configuration hasn't changed, there may be another cause outside of this variable. In that case, further investigation into your deployment or logs would be needed.
a
It's weird because if i go to the table elementary.dbt_tests for example, i see all of my 130 tests there. And basically in the deployment that broke that on-run-end hook, i only added new tests in the schema.yml file, removed one test. And for the elementary schema i have this written already :
+enabled: "{{ target.name == 'elementary-prod' | as_bool }}"
is there potentially a mistake in that enabled line ? @kapa.ai
k
A message from kapa.ai
Your
+enabled
line:
Copy code
yaml +enabled: "{{ target.name == 'elementary-prod' | as_bool }}"
may be problematic due to the placement of the
| as_bool
filter. In dbt, the
as_bool
filter should be applied to the entire expression, not just the string
'elementary-prod'
. The correct syntax should be:
Copy code
yaml +enabled: "{{ (target.name == 'elementary-prod') | as_bool }}"
This ensures that the comparison is evaluated first, and then the result (
True
or
False
) is converted to a boolean. If you write it as you currently have, dbt will always convert the string
'elementary-prod'
to
True
, which is not what you want. This mistake could cause the Elementary models to be enabled in all environments, or not at all, depending on how dbt interprets the expression. This could explain why the on-run-end hook is not behaving as expected after your deployment. Recommendation: Update your
dbt_project.yml
to use the correct syntax:
Copy code
yaml +enabled: "{{ (target.name == 'elementary-prod') | as_bool }}"
This approach is confirmed in multiple support threads and documentation as the correct way to conditionally enable Elementary models by target name [[FAQ](https://docs.elementary-data.com/oss/general/faq)], [[Slack thread](https://slack.com/archives/C02CTC89LAX/p1664996355098769)]. After making this change, re-run your dbt commands and check if the on-run-end hook appears in your logs and if the dashboard updates as expected.