|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | # |
3 | 3 | # This file is part of REANA. |
4 | | -# Copyright (C) 2021, 2022 CERN. |
| 4 | +# Copyright (C) 2021, 2022, 2024 CERN. |
5 | 5 | # |
6 | 6 | # REANA is free software; you can redistribute it and/or modify it |
7 | 7 | # under the terms of the MIT License; see LICENSE file for more details. |
|
24 | 24 | REANA_KUBERNETES_JOBS_TIMEOUT_LIMIT, |
25 | 25 | REANA_KUBERNETES_JOBS_MAX_USER_TIMEOUT_LIMIT, |
26 | 26 | REANA_INTERACTIVE_SESSION_MAX_INACTIVITY_PERIOD, |
| 27 | + DASK_ENABLED, |
| 28 | + REANA_DASK_CLUSTER_DEFAULT_NUMBER_OF_WORKERS, |
| 29 | + REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT, |
| 30 | + REANA_DASK_CLUSTER_DEFAULT_SINGLE_WORKER_MEMORY, |
| 31 | + REANA_DASK_CLUSTER_MAX_SINGLE_WORKER_MEMORY, |
27 | 32 | ) |
28 | 33 | from reana_server.decorators import signin_required |
29 | 34 |
|
@@ -125,6 +130,41 @@ def info(user, **kwargs): # noqa |
125 | 130 | type: string |
126 | 131 | type: array |
127 | 132 | type: object |
| 133 | + dask_enabled: |
| 134 | + properties: |
| 135 | + title: |
| 136 | + type: string |
| 137 | + value: |
| 138 | + type: string |
| 139 | + type: object |
| 140 | + dask_cluster_max_memory_limit: |
| 141 | + properties: |
| 142 | + title: |
| 143 | + type: string |
| 144 | + value: |
| 145 | + type: string |
| 146 | + type: object |
| 147 | + dask_cluster_default_number_of_workers: |
| 148 | + properties: |
| 149 | + title: |
| 150 | + type: string |
| 151 | + value: |
| 152 | + type: string |
| 153 | + type: object |
| 154 | + dask_cluster_default_single_worker_memory: |
| 155 | + properties: |
| 156 | + title: |
| 157 | + type: string |
| 158 | + value: |
| 159 | + type: string |
| 160 | + type: object |
| 161 | + dask_cluster_max_single_worker_memory: |
| 162 | + properties: |
| 163 | + title: |
| 164 | + type: string |
| 165 | + value: |
| 166 | + type: string |
| 167 | + type: object |
128 | 168 | type: object |
129 | 169 | examples: |
130 | 170 | application/json: |
@@ -165,6 +205,26 @@ def info(user, **kwargs): # noqa |
165 | 205 | "title": "Maximum timeout for Kubernetes jobs", |
166 | 206 | "value": "1209600" |
167 | 207 | }, |
| 208 | + "dask_enabled": { |
| 209 | + "title": "Dask workflows allowed in the cluster", |
| 210 | + "value": "False" |
| 211 | + }, |
| 212 | + "dask_cluster_max_memory_limit": { |
| 213 | + "title": "The maximum memory limit for Dask clusters created by users", |
| 214 | + "value": "16Gi" |
| 215 | + }, |
| 216 | + "dask_cluster_default_number_of_workers": { |
| 217 | + "title": "The number of Dask workers created by default", |
| 218 | + "value": "2Gi" |
| 219 | + }, |
| 220 | + "dask_cluster_default_single_worker_memory": { |
| 221 | + "title": "The amount of memory used by default by a single Dask worker", |
| 222 | + "value": "2Gi" |
| 223 | + }, |
| 224 | + "dask_cluster_max_single_worker_memory": { |
| 225 | + "title": "The maximum amount of memory that users can ask for the single Dask worker", |
| 226 | + "value": "8Gi" |
| 227 | + }, |
168 | 228 | } |
169 | 229 | 500: |
170 | 230 | description: >- |
@@ -217,7 +277,29 @@ def info(user, **kwargs): # noqa |
217 | 277 | title="Maximum inactivity period in days before automatic closure of interactive sessions", |
218 | 278 | value=REANA_INTERACTIVE_SESSION_MAX_INACTIVITY_PERIOD, |
219 | 279 | ), |
| 280 | + dask_enabled=dict( |
| 281 | + title="Dask workflows allowed in the cluster", |
| 282 | + value=bool(DASK_ENABLED), |
| 283 | + ), |
220 | 284 | ) |
| 285 | + if DASK_ENABLED: |
| 286 | + cluster_information["dask_cluster_default_number_of_workers"] = dict( |
| 287 | + title="The number of Dask workers created by default", |
| 288 | + value=REANA_DASK_CLUSTER_DEFAULT_NUMBER_OF_WORKERS, |
| 289 | + ) |
| 290 | + cluster_information["dask_cluster_max_memory_limit"] = dict( |
| 291 | + title="The maximum memory limit for Dask clusters created by users", |
| 292 | + value=REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT, |
| 293 | + ) |
| 294 | + cluster_information["dask_cluster_default_single_worker_memory"] = dict( |
| 295 | + title="The amount of memory used by default by a single Dask worker", |
| 296 | + value=REANA_DASK_CLUSTER_DEFAULT_SINGLE_WORKER_MEMORY, |
| 297 | + ) |
| 298 | + cluster_information["dask_cluster_max_single_worker_memory"] = dict( |
| 299 | + title="The maximum amount of memory that users can ask for the single Dask worker", |
| 300 | + value=REANA_DASK_CLUSTER_MAX_SINGLE_WORKER_MEMORY, |
| 301 | + ) |
| 302 | + |
221 | 303 | return InfoSchema().dump(cluster_information) |
222 | 304 |
|
223 | 305 | except Exception as e: |
@@ -260,3 +342,10 @@ class InfoSchema(Schema): |
260 | 342 | maximum_interactive_session_inactivity_period = fields.Nested( |
261 | 343 | StringNullableInfoValue |
262 | 344 | ) |
| 345 | + kubernetes_max_memory_limit = fields.Nested(StringInfoValue) |
| 346 | + dask_enabled = fields.Nested(StringInfoValue) |
| 347 | + if DASK_ENABLED: |
| 348 | + dask_cluster_default_number_of_workers = fields.Nested(StringInfoValue) |
| 349 | + dask_cluster_max_memory_limit = fields.Nested(StringInfoValue) |
| 350 | + dask_cluster_default_single_worker_memory = fields.Nested(StringInfoValue) |
| 351 | + dask_cluster_max_single_worker_memory = fields.Nested(StringInfoValue) |
0 commit comments