If a test from a previous period is marked as fail...
# ask-elementary-ai
a
If a test from a previous period is marked as failed, is it possible to configure a restart of that test the next time the tests are run?
k
A message from kapa.ai
Yes, it is possible to force a "restart" or retraining of a test in Elementary if you want it to disregard previous periods and use only the latest data. You can do this by running your dbt command with the variable
force_metrics_backfill
set to
true
. For example:
Copy code
dbt test --vars '{"force_metrics_backfill": true}'
This will ensure that the metrics are recalculated and the test is effectively "restarted" for the next run, rather than relying on the previous training period's data. This is particularly useful if the underlying data has changed significantly (e.g., the table was dropped and recreated), and you want the test to reflect the new state rather than historical failures or patterns. By default, Elementary optimizes for performance and does not always retrain on the full period unless this flag is set, so using
force_metrics_backfill
is the recommended approach in such scenarios [Slack thread on retraining tests](https://slack.com/archives/C02CTC89LAX/p1698154501770259).
a
@kapa.ai Is it possible to set up tests so that in case of failure, the detection_period increases. That is, the period in which the test was unsuccessful is re-checked the next time the test is run until the test is successfully passed for this period
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not mention any built-in functionality in Elementary Data to automatically increase the detection_period or to re-check a failed period until it passes. The detection_period parameter is static and must be configured manually in your test configuration. There is no documented feature that dynamically adjusts the detection window based on test outcomes or automatically re-tests failed periods in subsequent runs. If you need to re-check or retrain tests after failures, you can use the force_metrics_backfill option to recalculate metrics, but this does not dynamically adjust the detection period or automate the process you described. Any such workflow would need to be managed externally, for example, by adjusting your test configurations or orchestration logic outside of Elementary Data itself [Slack thread on retraining tests](https://slack.com/archives/C02CTC89LAX/p1698154501770259). If you have a specific use case, you may want to suggest it as a feature request to the Elementary team.