diff --git a/docs/docs/reference/project-files/rill-yaml.md b/docs/docs/reference/project-files/rill-yaml.md index 87758c0c139..8208bf78a6c 100644 --- a/docs/docs/reference/project-files/rill-yaml.md +++ b/docs/docs/reference/project-files/rill-yaml.md @@ -146,6 +146,8 @@ _[object]_ - A map of key-value pairs for setting variables on your project. It - **`rill.model.tests_warn_on_failure`** - _[boolean]_ - When true, model test failures are surfaced as non-blocking warnings instead of errors. Default: true in `prod`, false otherwise. + - **`rill.models.disable`** - _[boolean]_ - When true, model execution is disabled. Useful for stopping any ingestion in Rill temporarily. Default: false. + - **`rill.metrics.approximate_comparisons`** - _[boolean]_ - Rewrite metrics comparison queries to use an approximate, faster form. Approximate comparisons may not return data points for all values. Default: true. - **`rill.metrics.approximate_comparisons_cte`** - _[boolean]_ - Rewrite metrics comparison queries to use a CTE for the base query. Default: false. diff --git a/runtime/drivers/registry.go b/runtime/drivers/registry.go index 6ffd7c27b3c..993ee9f023f 100644 --- a/runtime/drivers/registry.go +++ b/runtime/drivers/registry.go @@ -143,6 +143,8 @@ type InstanceConfig struct { ModelPartitionsWarnOnFailure bool `mapstructure:"rill.model.partitions_warn_on_failure"` // ModelTestsWarnOnFailure: when true, model test failures are surfaced as non-blocking warnings instead of errors. ModelTestsWarnOnFailure bool `mapstructure:"rill.model.tests_warn_on_failure"` + // DisableModels: when true, model execution is disabled. Useful for stopping any ingestion in Rill temporarily. + DisableModels bool `mapstructure:"rill.models.disable"` } // ResolveOLAPConnector resolves the OLAP connector to default to for the instance. diff --git a/runtime/parser/schema/rillyaml.schema.yaml b/runtime/parser/schema/rillyaml.schema.yaml index 73c99642f3f..29d67f3fab8 100644 --- a/runtime/parser/schema/rillyaml.schema.yaml +++ b/runtime/parser/schema/rillyaml.schema.yaml @@ -142,6 +142,9 @@ allOf: rill.model.tests_warn_on_failure: type: boolean description: "When true, model test failures are surfaced as non-blocking warnings instead of errors. Default: true in `prod`, false otherwise." + rill.models.disable: + type: boolean + description: "When true, model execution is disabled. Useful for stopping any ingestion in Rill temporarily. Default: false." rill.metrics.approximate_comparisons: type: boolean description: "Rewrite metrics comparison queries to use an approximate, faster form. Approximate comparisons may not return data points for all values. Default: true." diff --git a/runtime/reconcilers/model.go b/runtime/reconcilers/model.go index fc09a0bee9c..d90d6bea8a0 100644 --- a/runtime/reconcilers/model.go +++ b/runtime/reconcilers/model.go @@ -152,6 +152,10 @@ func (r *ModelReconciler) Reconcile(ctx context.Context, n *runtimev1.ResourceNa defer cancel() } + if cfg.DisableModels { // Global disable + return runtime.ReconcileResult{Err: errors.New("model execution is paused")} + } + // Handle deletion if self.Meta.DeletedOn != nil { if prevManager != nil {