Skip to content
Snippets Groups Projects
Unverified Commit 8103e379 authored by Kyle Doherty's avatar Kyle Doherty
Browse files

Merge branch 'xray-admin-toggle' of github.com:metabase/metabase into xray-admin-toggle

parents 81d103bf 6e121070
Branches
Tags
No related merge requests found
(ns metabase.api.x-ray
(:require [compojure.core :refer [GET]]
(:require [compojure.core :refer [GET PUT]]
[metabase.api.common :as api]
[metabase.feature-extraction.core :as fe]
[metabase.models
......@@ -7,7 +7,8 @@
[field :refer [Field]]
[metric :refer [Metric]]
[segment :refer [Segment]]
[table :refer [Table]]]
[table :refer [Table]]
[setting :as setting]]
[schema.core :as s]))
;; See metabase.feature-extraction.core/extract-features for description of
......@@ -188,4 +189,15 @@
"table" "table"
"segment" "table"]])
(def ^:private Settings
{:xray-max-cost (s/enum "exact" "approximate" "extended")
:enable-xrays s/Bool})
(api/defendpoint PUT "/settings"
"Update x-ray related settings. You must be a superuser to do this."
[:as {settings :body}]
{settings Settings}
(api/check-superuser)
(setting/set-many! settings))
(api/define-routes)
(ns metabase.feature-extraction.costs
"Predicates for limiting resource expanditure during feature extraction."
(:require [schema.core :as s]))
(:require [metabase.models
[setting :refer [defsetting] :as setting]]
[schema.core :as s]))
(def MaxCost
"Schema for max-cost parameter."
{:computation (s/enum :linear :unbounded :yolo)
:query (s/enum :cache :sample :full-scan :joins)})
(defsetting xray-max-cost
"Cap resorce expanditure for all x-rays. (exact, approximate, or extended)"
:type :string
:default "extended"
:setter (fn [new-value]
(when-not (nil? new-value)
(assert (contains? #{"exact" "approximate" "extended"} new-value)))
(setting/set-string! :max-cost new-value)))
(defsetting enable-xrays
"Should x-raying be available at all?"
:type :boolean
:default true)
(def ^{:arglists '([max-cost])} linear-computation?
"Limit computation to O(n) or better."
(comp #{:linear} :computation))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment