zenml-nightly 0.70.0.dev20241122__py3-none-any.whl → 0.70.0.dev20241201__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. zenml/VERSION +1 -1
  2. zenml/artifact_stores/base_artifact_store.py +2 -2
  3. zenml/artifacts/artifact_config.py +7 -1
  4. zenml/artifacts/utils.py +56 -31
  5. zenml/cli/__init__.py +18 -0
  6. zenml/cli/base.py +4 -4
  7. zenml/cli/login.py +26 -0
  8. zenml/cli/pipeline.py +80 -0
  9. zenml/cli/server.py +1 -1
  10. zenml/cli/service_connectors.py +3 -3
  11. zenml/cli/stack.py +0 -3
  12. zenml/cli/stack_components.py +0 -1
  13. zenml/cli/utils.py +0 -5
  14. zenml/client.py +8 -18
  15. zenml/config/compiler.py +12 -3
  16. zenml/config/pipeline_configurations.py +20 -0
  17. zenml/config/pipeline_run_configuration.py +1 -0
  18. zenml/config/step_configurations.py +21 -0
  19. zenml/constants.py +1 -0
  20. zenml/enums.py +1 -0
  21. zenml/image_builders/local_image_builder.py +13 -3
  22. zenml/integrations/__init__.py +1 -0
  23. zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +14 -6
  24. zenml/integrations/constants.py +1 -0
  25. zenml/integrations/feast/__init__.py +1 -1
  26. zenml/integrations/feast/feature_stores/feast_feature_store.py +13 -9
  27. zenml/integrations/kubernetes/orchestrators/kube_utils.py +54 -9
  28. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator.py +65 -3
  29. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +14 -2
  30. zenml/integrations/kubernetes/orchestrators/manifest_utils.py +6 -5
  31. zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +2 -1
  32. zenml/integrations/kubernetes/step_operators/kubernetes_step_operator.py +3 -1
  33. zenml/integrations/modal/__init__.py +46 -0
  34. zenml/integrations/modal/flavors/__init__.py +26 -0
  35. zenml/integrations/modal/flavors/modal_step_operator_flavor.py +125 -0
  36. zenml/integrations/modal/step_operators/__init__.py +22 -0
  37. zenml/integrations/modal/step_operators/modal_step_operator.py +242 -0
  38. zenml/io/filesystem.py +2 -2
  39. zenml/io/local_filesystem.py +3 -3
  40. zenml/materializers/built_in_materializer.py +18 -1
  41. zenml/materializers/structured_string_materializer.py +8 -3
  42. zenml/model/model.py +11 -85
  43. zenml/model/utils.py +18 -16
  44. zenml/models/__init__.py +12 -1
  45. zenml/models/v2/core/artifact_version.py +6 -3
  46. zenml/models/v2/core/component.py +0 -22
  47. zenml/models/v2/core/model_version.py +6 -3
  48. zenml/models/v2/core/pipeline_run.py +19 -3
  49. zenml/models/v2/core/run_metadata.py +30 -9
  50. zenml/models/v2/core/service_connector.py +4 -0
  51. zenml/models/v2/core/step_run.py +6 -4
  52. zenml/models/v2/misc/run_metadata.py +38 -0
  53. zenml/models/v2/misc/server_models.py +23 -0
  54. zenml/orchestrators/input_utils.py +19 -6
  55. zenml/orchestrators/publish_utils.py +12 -5
  56. zenml/orchestrators/step_launcher.py +7 -3
  57. zenml/orchestrators/step_run_utils.py +26 -9
  58. zenml/orchestrators/step_runner.py +40 -3
  59. zenml/orchestrators/utils.py +24 -23
  60. zenml/pipelines/pipeline_decorator.py +4 -0
  61. zenml/pipelines/pipeline_definition.py +26 -8
  62. zenml/pipelines/run_utils.py +9 -5
  63. zenml/steps/base_step.py +11 -1
  64. zenml/steps/entrypoint_function_utils.py +7 -3
  65. zenml/steps/step_decorator.py +4 -0
  66. zenml/steps/utils.py +23 -7
  67. zenml/types.py +4 -0
  68. zenml/utils/metadata_utils.py +186 -153
  69. zenml/utils/string_utils.py +41 -16
  70. zenml/utils/visualization_utils.py +4 -1
  71. zenml/zen_server/cloud_utils.py +3 -1
  72. zenml/zen_server/deploy/helm/templates/_environment.tpl +117 -0
  73. zenml/zen_server/deploy/helm/templates/server-db-job.yaml +3 -14
  74. zenml/zen_server/deploy/helm/templates/server-deployment.yaml +16 -4
  75. zenml/zen_server/deploy/helm/templates/server-secret.yaml +2 -17
  76. zenml/zen_server/rbac/endpoint_utils.py +6 -4
  77. zenml/zen_server/rbac/models.py +3 -2
  78. zenml/zen_server/rbac/utils.py +4 -7
  79. zenml/zen_server/routers/server_endpoints.py +47 -0
  80. zenml/zen_server/routers/users_endpoints.py +35 -37
  81. zenml/zen_server/routers/workspaces_endpoints.py +44 -55
  82. zenml/zen_server/template_execution/utils.py +1 -0
  83. zenml/zen_server/zen_server_api.py +45 -6
  84. zenml/zen_stores/migrations/utils.py +40 -24
  85. zenml/zen_stores/migrations/versions/b73bc71f1106_remove_component_spec_path.py +36 -0
  86. zenml/zen_stores/migrations/versions/cc269488e5a9_separate_run_metadata.py +135 -0
  87. zenml/zen_stores/migrations/versions/ec6307720f92_simplify_model_version_links.py +7 -6
  88. zenml/zen_stores/rest_zen_store.py +38 -1
  89. zenml/zen_stores/schemas/__init__.py +5 -1
  90. zenml/zen_stores/schemas/artifact_schemas.py +12 -11
  91. zenml/zen_stores/schemas/component_schemas.py +0 -3
  92. zenml/zen_stores/schemas/model_schemas.py +13 -11
  93. zenml/zen_stores/schemas/pipeline_run_schemas.py +44 -16
  94. zenml/zen_stores/schemas/run_metadata_schemas.py +66 -31
  95. zenml/zen_stores/schemas/step_run_schemas.py +32 -12
  96. zenml/zen_stores/schemas/utils.py +47 -3
  97. zenml/zen_stores/sql_zen_store.py +130 -34
  98. {zenml_nightly-0.70.0.dev20241122.dist-info → zenml_nightly-0.70.0.dev20241201.dist-info}/METADATA +1 -1
  99. {zenml_nightly-0.70.0.dev20241122.dist-info → zenml_nightly-0.70.0.dev20241201.dist-info}/RECORD +102 -95
  100. zenml/utils/cloud_utils.py +0 -40
  101. {zenml_nightly-0.70.0.dev20241122.dist-info → zenml_nightly-0.70.0.dev20241201.dist-info}/LICENSE +0 -0
  102. {zenml_nightly-0.70.0.dev20241122.dist-info → zenml_nightly-0.70.0.dev20241201.dist-info}/WHEEL +0 -0
  103. {zenml_nightly-0.70.0.dev20241122.dist-info → zenml_nightly-0.70.0.dev20241201.dist-info}/entry_points.txt +0 -0
@@ -3,6 +3,123 @@ Helpers for environment variables configured in ZenML deployments and secrets st
3
3
  */}}
4
4
 
5
5
 
6
+ {{/*
7
+ ZenML store configuration options (non-secret values).
8
+
9
+ This template constructs a dictionary that is similar to the python values that
10
+ can be configured in the zenml.zen_store.sql_zen_store.SqlZenStoreConfiguration
11
+ class. Only non-secret values are included in this dictionary.
12
+
13
+ The dictionary is then converted into deployment environment variables by other
14
+ templates and inserted where it is needed.
15
+
16
+ The input is taken from a .ZenML dict that is passed to the template and
17
+ contains the values configured in the values.yaml file for the ZenML server.
18
+
19
+ Args:
20
+ .ZenML: A dictionary with the ZenML configuration values configured for the
21
+ ZenML server.
22
+ Returns:
23
+ A dictionary with the non-secret values configured for the ZenML store.
24
+ */}}
25
+ {{- define "zenml.storeConfigurationAttrs" -}}
26
+ {{- if .ZenML.database.url }}
27
+ type: sql
28
+ ssl_verify_server_cert: {{ .ZenML.database.sslVerifyServerCert | default "false" | quote }}
29
+ {{- if .ZenML.database.backupStrategy }}
30
+ backup_strategy: {{ .ZenML.database.backupStrategy | quote }}
31
+ {{- if eq .ZenML.database.backupStrategy "database" }}
32
+ backup_database: {{ .ZenML.database.backupDatabase | quote }}
33
+ {{- else if eq .ZenML.database.backupStrategy "dump-file" }}
34
+ backup_directory: "/backups"
35
+ {{- end }}
36
+ {{- end }}
37
+ {{- if .ZenML.database.poolSize }}
38
+ pool_size: {{ .ZenML.database.poolSize | quote }}
39
+ {{- end }}
40
+ {{- if .ZenML.database.maxOverflow }}
41
+ max_overflow: {{ .ZenML.database.maxOverflow | quote }}
42
+ {{- end }}
43
+ {{- end }}
44
+ {{- end }}
45
+
46
+
47
+ {{/*
48
+ ZenML store configuration options (secret values).
49
+
50
+ This template constructs a dictionary that is similar to the python values that
51
+ can be configured in the zenml.zen_store.sql_zen_store.SqlZenStoreConfiguration
52
+ class. Only secret values are included in this dictionary.
53
+
54
+ The dictionary is then converted into deployment environment variables by other
55
+ templates and inserted where it is needed.
56
+
57
+ The input is taken from a .ZenML dict that is passed to the template and
58
+ contains the values configured in the values.yaml file for the ZenML server.
59
+
60
+ Args:
61
+ .ZenML: A dictionary with the ZenML configuration values configured for the
62
+ ZenML server.
63
+ Returns:
64
+ A dictionary with the secret values configured for the ZenML store.
65
+ */}}
66
+ {{- define "zenml.storeSecretConfigurationAttrs" -}}
67
+ {{- if .ZenML.database.url }}
68
+ url: {{ .ZenML.database.url | quote }}
69
+ {{- if .ZenML.database.sslCa }}
70
+ ssl_ca: {{ .Files.Get .ZenML.database.sslCa }}
71
+ {{- end }}
72
+ {{- if .ZenML.database.sslCert }}
73
+ ssl_cert: {{ .Files.Get .ZenML.database.sslCert }}
74
+ {{- end }}
75
+ {{- if .ZenML.database.sslKey }}
76
+ ssl_key: {{ .Files.Get .ZenML.database.sslKey }}
77
+ {{- end }}
78
+ {{- end }}
79
+ {{- end }}
80
+
81
+
82
+ {{/*
83
+ Store configuration environment variables (non-secret values).
84
+
85
+ Passes the .Values.zenml dict as input to the `zenml.storeConfigurationAttrs`
86
+ template and converts the output into a dictionary of environment variables that
87
+ need to be configured for the store.
88
+
89
+ Args:
90
+ .Values: The values.yaml file for the ZenML deployment.
91
+ Returns:
92
+ A dictionary with the non-secret environment variables that are configured for
93
+ the store (i.e. keys starting with `ZENML_STORE_`).
94
+ */}}
95
+ {{- define "zenml.storeEnvVariables" -}}
96
+ {{ $zenml := dict "ZenML" .Values.zenml }}
97
+ {{- range $k, $v := include "zenml.storeConfigurationAttrs" $zenml | fromYaml }}
98
+ ZENML_STORE_{{ $k | upper }}: {{ $v | quote }}
99
+ {{- end }}
100
+ {{- end }}
101
+
102
+
103
+ {{/*
104
+ Store configuration environment variables (secret values).
105
+
106
+ Passes the .Values.zenml dict as input to the `zenml.storeSecretConfigurationAttrs`
107
+ template and converts the output into a dictionary of environment variables that
108
+ need to be configured for the store.
109
+
110
+ Args:
111
+ .Values: The values.yaml file for the ZenML deployment.
112
+ Returns:
113
+ A dictionary with the secret environment variables that are configured for
114
+ the store (i.e. keys starting with `ZENML_STORE_`).
115
+ */}}
116
+ {{- define "zenml.storeSecretEnvVariables" -}}
117
+ {{ $zenml := dict "ZenML" .Values.zenml }}
118
+ {{- range $k, $v := include "zenml.storeSecretConfigurationAttrs" $zenml | fromYaml }}
119
+ ZENML_STORE_{{ $k | upper }}: {{ $v | quote }}
120
+ {{- end }}
121
+ {{- end }}
122
+
6
123
  {{/*
7
124
  ZenML server configuration options (non-secret values).
8
125
 
@@ -79,20 +79,9 @@ spec:
79
79
  {{- end }}
80
80
  - name: ZENML_DEFAULT_PROJECT_NAME
81
81
  value: {{ .Values.zenml.defaultProject | quote }}
82
- - name: ZENML_STORE_TYPE
83
- value: sql
84
- - name: ZENML_STORE_SSL_VERIFY_SERVER_CERT
85
- value: {{ .Values.zenml.database.sslVerifyServerCert | default "false" | quote }}
86
- {{- if .Values.zenml.database.backupStrategy }}
87
- - name: ZENML_STORE_BACKUP_STRATEGY
88
- value: {{ .Values.zenml.database.backupStrategy | quote }}
89
- {{- if eq .Values.zenml.database.backupStrategy "database" }}
90
- - name: ZENML_STORE_BACKUP_DATABASE
91
- value: {{ .Values.zenml.database.backupDatabase | quote }}
92
- {{- else if eq .Values.zenml.database.backupStrategy "dump-file" }}
93
- - name: ZENML_STORE_BACKUP_DIRECTORY
94
- value: /backups
95
- {{- end }}
82
+ {{- range $k, $v := include "zenml.storeEnvVariables" . | fromYaml }}
83
+ - name: {{ $k }}
84
+ value: {{ $v | quote }}
96
85
  {{- end }}
97
86
  {{- range $k, $v := include "zenml.serverEnvVariables" . | fromYaml }}
98
87
  - name: {{ $k }}
@@ -63,14 +63,14 @@ spec:
63
63
  value: "True"
64
64
  {{- end }}
65
65
  {{- if .Values.zenml.database.url }}
66
- - name: ZENML_STORE_TYPE
67
- value: sql
68
66
  - name: DISABLE_DATABASE_MIGRATION
69
67
  value: "True"
70
- - name: ZENML_STORE_SSL_VERIFY_SERVER_CERT
71
- value: {{ .Values.zenml.database.sslVerifyServerCert | default "false" | quote }}
72
68
  {{- end }}
73
69
 
70
+ {{- range $k, $v := include "zenml.storeEnvVariables" . | fromYaml }}
71
+ - name: {{ $k }}
72
+ value: {{ $v | quote }}
73
+ {{- end }}
74
74
  {{- range $k, $v := include "zenml.serverEnvVariables" . | fromYaml }}
75
75
  - name: {{ $k }}
76
76
  value: {{ $v | quote }}
@@ -104,6 +104,18 @@ spec:
104
104
  httpGet:
105
105
  path: /health
106
106
  port: http
107
+ lifecycle:
108
+ preStop:
109
+ exec:
110
+ # Give the process 15 more seconds before the SIGTERM signal is
111
+ # sent. This allows the endpoint removal to reach the ingress
112
+ # controller in time and for traffic to be routed away from the
113
+ # pod before it is shut down. This eliminates the number of 502
114
+ # errors returned to the user.
115
+ #
116
+ # See https://learnk8s.io/graceful-shutdown for more information.
117
+ #
118
+ command: ["sleep", "15"]
107
119
  resources:
108
120
  {{- toYaml .Values.resources | nindent 12 }}
109
121
  {{- with .Values.nodeSelector }}
@@ -10,23 +10,8 @@ data:
10
10
  {{- else }}
11
11
  ZENML_SERVER_JWT_SECRET_KEY: {{ $prevServerSecret.data.ZENML_SERVER_JWT_SECRET_KEY | default (randAlphaNum 32 | b64enc | quote) }}
12
12
  {{- end }}
13
- {{- if .Values.zenml.database.url }}
14
- ZENML_STORE_URL: {{ .Values.zenml.database.url | b64enc | quote }}
15
- {{- if .Values.zenml.database.sslCa }}
16
- ZENML_STORE_SSL_CA: {{ .Files.Get .Values.zenml.database.sslCa | b64enc }}
17
- {{- end }}
18
- {{- if .Values.zenml.database.sslCert }}
19
- ZENML_STORE_SSL_CERT: {{ .Files.Get .Values.zenml.database.sslCert | b64enc }}
20
- {{- end }}
21
- {{- if .Values.zenml.database.sslKey }}
22
- ZENML_STORE_SSL_KEY: {{ .Files.Get .Values.zenml.database.sslKey | b64enc }}
23
- {{- end }}
24
- {{- if .Values.zenml.database.poolSize }}
25
- ZENML_STORE_POOL_SIZE: {{ .Values.zenml.database.poolSize | b64enc | quote }}
26
- {{- end }}
27
- {{- if .Values.zenml.database.maxOverflow }}
28
- ZENML_STORE_MAX_OVERFLOW: {{ .Values.zenml.database.maxOverflow | b64enc | quote }}
29
- {{- end }}
13
+ {{- range $k, $v := include "zenml.storeSecretEnvVariables" . | fromYaml}}
14
+ {{ $k }}: {{ $v | b64enc | quote }}
30
15
  {{- end }}
31
16
  {{- range $k, $v := include "zenml.secretsStoreSecretEnvVariables" . | fromYaml}}
32
17
  {{ $k }}: {{ $v | b64enc | quote }}
@@ -189,7 +189,7 @@ def verify_permissions_and_list_entities(
189
189
  def verify_permissions_and_update_entity(
190
190
  id: UUIDOrStr,
191
191
  update_model: AnyUpdate,
192
- get_method: Callable[[UUIDOrStr], AnyResponse],
192
+ get_method: Callable[[UUIDOrStr, bool], AnyResponse],
193
193
  update_method: Callable[[UUIDOrStr, AnyUpdate], AnyResponse],
194
194
  ) -> AnyResponse:
195
195
  """Verify permissions and update an entity.
@@ -203,7 +203,8 @@ def verify_permissions_and_update_entity(
203
203
  Returns:
204
204
  A model of the updated entity.
205
205
  """
206
- model = get_method(id)
206
+ # We don't need the hydrated version here
207
+ model = get_method(id, False)
207
208
  verify_permission_for_model(model, action=Action.UPDATE)
208
209
  updated_model = update_method(model.id, update_model)
209
210
  return dehydrate_response_model(updated_model)
@@ -211,7 +212,7 @@ def verify_permissions_and_update_entity(
211
212
 
212
213
  def verify_permissions_and_delete_entity(
213
214
  id: UUIDOrStr,
214
- get_method: Callable[[UUIDOrStr], AnyResponse],
215
+ get_method: Callable[[UUIDOrStr, bool], AnyResponse],
215
216
  delete_method: Callable[[UUIDOrStr], None],
216
217
  ) -> AnyResponse:
217
218
  """Verify permissions and delete an entity.
@@ -224,7 +225,8 @@ def verify_permissions_and_delete_entity(
224
225
  Returns:
225
226
  The deleted entity.
226
227
  """
227
- model = get_method(id)
228
+ # We don't need the hydrated version here
229
+ model = get_method(id, False)
228
230
  verify_permission_for_model(model, action=Action.DELETE)
229
231
  delete_method(model.id)
230
232
 
@@ -59,7 +59,6 @@ class ResourceType(StrEnum):
59
59
  PIPELINE_DEPLOYMENT = "pipeline_deployment"
60
60
  PIPELINE_BUILD = "pipeline_build"
61
61
  RUN_TEMPLATE = "run_template"
62
- USER = "user"
63
62
  SERVICE = "service"
64
63
  RUN_METADATA = "run_metadata"
65
64
  SECRET = "secret"
@@ -70,7 +69,9 @@ class ResourceType(StrEnum):
70
69
  TAG = "tag"
71
70
  TRIGGER = "trigger"
72
71
  TRIGGER_EXECUTION = "trigger_execution"
73
- WORKSPACE = "workspace"
72
+ # Deactivated for now
73
+ # USER = "user"
74
+ # WORKSPACE = "workspace"
74
75
 
75
76
 
76
77
  class Resource(BaseModel):
@@ -413,8 +413,6 @@ def get_resource_type_for_model(
413
413
  TagResponse,
414
414
  TriggerExecutionResponse,
415
415
  TriggerResponse,
416
- UserResponse,
417
- WorkspaceResponse,
418
416
  )
419
417
 
420
418
  mapping: Dict[
@@ -434,8 +432,8 @@ def get_resource_type_for_model(
434
432
  ModelVersionResponse: ResourceType.MODEL_VERSION,
435
433
  ArtifactResponse: ResourceType.ARTIFACT,
436
434
  ArtifactVersionResponse: ResourceType.ARTIFACT_VERSION,
437
- WorkspaceResponse: ResourceType.WORKSPACE,
438
- UserResponse: ResourceType.USER,
435
+ # WorkspaceResponse: ResourceType.WORKSPACE,
436
+ # UserResponse: ResourceType.USER,
439
437
  PipelineDeploymentResponse: ResourceType.PIPELINE_DEPLOYMENT,
440
438
  PipelineBuildResponse: ResourceType.PIPELINE_BUILD,
441
439
  PipelineRunResponse: ResourceType.PIPELINE_RUN,
@@ -570,7 +568,6 @@ def get_schema_for_resource_type(
570
568
  TriggerExecutionSchema,
571
569
  TriggerSchema,
572
570
  UserSchema,
573
- WorkspaceSchema,
574
571
  )
575
572
 
576
573
  mapping: Dict[ResourceType, Type["BaseSchema"]] = {
@@ -588,13 +585,13 @@ def get_schema_for_resource_type(
588
585
  ResourceType.SERVICE: ServiceSchema,
589
586
  ResourceType.TAG: TagSchema,
590
587
  ResourceType.SERVICE_ACCOUNT: UserSchema,
591
- ResourceType.WORKSPACE: WorkspaceSchema,
588
+ # ResourceType.WORKSPACE: WorkspaceSchema,
592
589
  ResourceType.PIPELINE_RUN: PipelineRunSchema,
593
590
  ResourceType.PIPELINE_DEPLOYMENT: PipelineDeploymentSchema,
594
591
  ResourceType.PIPELINE_BUILD: PipelineBuildSchema,
595
592
  ResourceType.RUN_TEMPLATE: RunTemplateSchema,
596
593
  ResourceType.RUN_METADATA: RunMetadataSchema,
597
- ResourceType.USER: UserSchema,
594
+ # ResourceType.USER: UserSchema,
598
595
  ResourceType.ACTION: ActionSchema,
599
596
  ResourceType.EVENT_SOURCE: EventSourceSchema,
600
597
  ResourceType.TRIGGER: TriggerSchema,
@@ -22,6 +22,7 @@ from zenml.constants import (
22
22
  ACTIVATE,
23
23
  API,
24
24
  INFO,
25
+ LOAD_INFO,
25
26
  ONBOARDING_STATE,
26
27
  SERVER_SETTINGS,
27
28
  VERSION_1,
@@ -30,6 +31,7 @@ from zenml.enums import AuthScheme
30
31
  from zenml.exceptions import IllegalOperationError
31
32
  from zenml.models import (
32
33
  ServerActivationRequest,
34
+ ServerLoadInfo,
33
35
  ServerModel,
34
36
  ServerSettingsResponse,
35
37
  ServerSettingsUpdate,
@@ -71,6 +73,51 @@ def server_info() -> ServerModel:
71
73
  return zen_store().get_store_info()
72
74
 
73
75
 
76
+ @router.get(
77
+ LOAD_INFO,
78
+ response_model=ServerLoadInfo,
79
+ )
80
+ @handle_exceptions
81
+ def server_load_info(_: AuthContext = Security(authorize)) -> ServerLoadInfo:
82
+ """Get information about the server load.
83
+
84
+ Returns:
85
+ Information about the server load.
86
+ """
87
+ import threading
88
+
89
+ # Get the current number of threads
90
+ num_threads = len(threading.enumerate())
91
+
92
+ store = zen_store()
93
+
94
+ if store.config.driver == "sqlite":
95
+ # SQLite doesn't have a connection pool
96
+ return ServerLoadInfo(
97
+ threads=num_threads,
98
+ db_connections_total=0,
99
+ db_connections_active=0,
100
+ db_connections_overflow=0,
101
+ )
102
+
103
+ from sqlalchemy.pool import QueuePool
104
+
105
+ # Get the number of connections
106
+ pool = store.engine.pool
107
+ assert isinstance(pool, QueuePool)
108
+ idle_conn = pool.checkedin()
109
+ active_conn = pool.checkedout()
110
+ overflow_conn = max(0, pool.overflow())
111
+ total_conn = idle_conn + active_conn
112
+
113
+ return ServerLoadInfo(
114
+ threads=num_threads,
115
+ db_connections_total=total_conn,
116
+ db_connections_active=active_conn,
117
+ db_connections_overflow=overflow_conn,
118
+ )
119
+
120
+
74
121
  @router.get(
75
122
  ONBOARDING_STATE,
76
123
  responses={
@@ -46,14 +46,10 @@ from zenml.zen_server.auth import (
46
46
  )
47
47
  from zenml.zen_server.exceptions import error_response
48
48
  from zenml.zen_server.rate_limit import RequestLimiter
49
- from zenml.zen_server.rbac.endpoint_utils import (
50
- verify_permissions_and_create_entity,
51
- )
52
49
  from zenml.zen_server.rbac.models import Action, Resource, ResourceType
53
50
  from zenml.zen_server.rbac.utils import (
54
51
  dehydrate_page,
55
52
  dehydrate_response_model,
56
- get_allowed_resource_ids,
57
53
  get_schema_for_resource_type,
58
54
  update_resource_membership,
59
55
  verify_permission_for_model,
@@ -112,17 +108,18 @@ def list_users(
112
108
  Returns:
113
109
  A list of all users.
114
110
  """
115
- allowed_ids = get_allowed_resource_ids(resource_type=ResourceType.USER)
116
- if allowed_ids is not None:
117
- # Make sure users can see themselves
118
- allowed_ids.add(auth_context.user.id)
119
- else:
120
- if not auth_context.user.is_admin and not server_config().rbac_enabled:
121
- allowed_ids = {auth_context.user.id}
122
-
123
- user_filter_model.configure_rbac(
124
- authenticated_user_id=auth_context.user.id, id=allowed_ids
125
- )
111
+ # allowed_ids = get_allowed_resource_ids(resource_type=ResourceType.USER)
112
+ # if allowed_ids is not None:
113
+ # # Make sure users can see themselves
114
+ # allowed_ids.add(auth_context.user.id)
115
+ # else:
116
+ # if not auth_context.user.is_admin and not server_config().rbac_enabled:
117
+ # allowed_ids = {auth_context.user.id}
118
+ if not auth_context.user.is_admin and not server_config().rbac_enabled:
119
+ user_filter_model.configure_rbac(
120
+ authenticated_user_id=auth_context.user.id,
121
+ id={auth_context.user.id},
122
+ )
126
123
 
127
124
  page = zen_store().list_users(
128
125
  user_filter_model=user_filter_model, hydrate=hydrate
@@ -175,11 +172,12 @@ if server_config().auth_scheme != AuthScheme.EXTERNAL:
175
172
  auth_context.user.is_admin, "create user"
176
173
  )
177
174
 
178
- new_user = verify_permissions_and_create_entity(
179
- request_model=user,
180
- resource_type=ResourceType.USER,
181
- create_method=zen_store().create_user,
182
- )
175
+ # new_user = verify_permissions_and_create_entity(
176
+ # request_model=user,
177
+ # resource_type=ResourceType.USER,
178
+ # create_method=zen_store().create_user,
179
+ # )
180
+ new_user = zen_store().create_user(user)
183
181
 
184
182
  # add back the original unhashed activation token, if generated, to
185
183
  # send it back to the client
@@ -217,10 +215,10 @@ def get_user(
217
215
  verify_admin_status_if_no_rbac(
218
216
  auth_context.user.is_admin, "get other user"
219
217
  )
220
- verify_permission_for_model(
221
- user,
222
- action=Action.READ,
223
- )
218
+ # verify_permission_for_model(
219
+ # user,
220
+ # action=Action.READ,
221
+ # )
224
222
 
225
223
  return dehydrate_response_model(user)
226
224
 
@@ -304,10 +302,10 @@ if server_config().auth_scheme != AuthScheme.EXTERNAL:
304
302
  verify_admin_status_if_no_rbac(
305
303
  auth_context.user.is_admin, "update other user account"
306
304
  )
307
- verify_permission_for_model(
308
- user,
309
- action=Action.UPDATE,
310
- )
305
+ # verify_permission_for_model(
306
+ # user,
307
+ # action=Action.UPDATE,
308
+ # )
311
309
 
312
310
  # Validate a password change
313
311
  if user_update.password is not None:
@@ -497,10 +495,10 @@ if server_config().auth_scheme != AuthScheme.EXTERNAL:
497
495
  verify_admin_status_if_no_rbac(
498
496
  auth_context.user.is_admin, "deactivate user"
499
497
  )
500
- verify_permission_for_model(
501
- user,
502
- action=Action.UPDATE,
503
- )
498
+ # verify_permission_for_model(
499
+ # user,
500
+ # action=Action.UPDATE,
501
+ # )
504
502
 
505
503
  user_update = UserUpdate(
506
504
  active=False,
@@ -548,10 +546,10 @@ if server_config().auth_scheme != AuthScheme.EXTERNAL:
548
546
  verify_admin_status_if_no_rbac(
549
547
  auth_context.user.is_admin, "delete user"
550
548
  )
551
- verify_permission_for_model(
552
- user,
553
- action=Action.DELETE,
554
- )
549
+ # verify_permission_for_model(
550
+ # user,
551
+ # action=Action.DELETE,
552
+ # )
555
553
 
556
554
  zen_store().delete_user(user_name_or_id=user_name_or_id)
557
555
 
@@ -746,7 +744,7 @@ if server_config().rbac_enabled:
746
744
  KeyError: If no resource with the given type and ID exists.
747
745
  """
748
746
  user = zen_store().get_user(user_name_or_id)
749
- verify_permission_for_model(user, action=Action.READ)
747
+ # verify_permission_for_model(user, action=Action.READ)
750
748
 
751
749
  if user.id == auth_context.user.id:
752
750
  raise ValueError(