-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfeatures_control_cloud.py
More file actions
51 lines (38 loc) · 1.27 KB
/
features_control_cloud.py
File metadata and controls
51 lines (38 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from sqlalchemy import select
from deepchecks_monitoring.features_control import FeaturesControl
from deepchecks_monitoring.public_models import Billing, User
class CloudFeaturesControl(FeaturesControl):
"""Feature controls class for the cloud version."""
def __init__(self, user: User, settings):
super().__init__(settings)
self.user = user
self._allowed_models = None
async def get_allowed_models(self, session) -> int:
if self._allowed_models is None:
self._allowed_models = await session.scalar(
select(Billing.bought_models).where(Billing.organization_id == self.user.organization_id)
)
if self._allowed_models is None:
return 1
return self._allowed_models + 1
@property
def update_roles(self) -> bool:
return True
@property
def model_assignment(self) -> bool:
return True
@property
def signup_enabled(self) -> bool:
return False
@property
def onboarding_enabled(self) -> bool:
return True
@property
def slack_enabled(self) -> bool:
return True
@property
def rows_per_minute(self) -> int:
return 500_000
@property
def multi_tenant(self) -> bool:
return True