From 220b5420ed088aea4117067c1c0f87c98fdd9562 Mon Sep 17 00:00:00 2001 From: Alputer Date: Thu, 19 Sep 2024 10:43:53 +0200 Subject: [PATCH] feat(dask): update info command to include autoscaler info (#701) closes reanahub/reana#834 --- reana_server/config.py | 3 +++ reana_server/rest/info.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/reana_server/config.py b/reana_server/config.py index 4d7031f8..7409a48a 100644 --- a/reana_server/config.py +++ b/reana_server/config.py @@ -61,6 +61,9 @@ DASK_ENABLED = strtobool(os.getenv("DASK_ENABLED", "true")) """Whether dask is enabled in the cluster or not""" +DASK_AUTOSCALER_ENABLED = strtobool(os.getenv("DASK_AUTOSCALER_ENABLED", "true")) +"""Whether dask autoscaler is enabled in the cluster or not""" + REANA_DASK_CLUSTER_MAX_CORES_LIMIT = float( os.getenv("REANA_DASK_CLUSTER_MAX_CORES_LIMIT", 8) ) diff --git a/reana_server/rest/info.py b/reana_server/rest/info.py index 6a3b3fef..26525e25 100644 --- a/reana_server/rest/info.py +++ b/reana_server/rest/info.py @@ -25,6 +25,7 @@ REANA_KUBERNETES_JOBS_MAX_USER_TIMEOUT_LIMIT, REANA_INTERACTIVE_SESSION_MAX_INACTIVITY_PERIOD, DASK_ENABLED, + DASK_AUTOSCALER_ENABLED, REANA_DASK_CLUSTER_MAX_CORES_LIMIT, REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT, REANA_DASK_CLUSTER_DEFAULT_CORES_LIMIT, @@ -139,6 +140,13 @@ def info(user, **kwargs): # noqa value: type: string type: object + dask_autoscaler_enabled: + properties: + title: + type: string + value: + type: string + type: object dask_cluster_default_cores_limit: properties: title: @@ -236,6 +244,10 @@ def info(user, **kwargs): # noqa "title": "Dask workflows allowed in the cluster", "value": "False" }, + "dask_autoscaler_enabled": { + "title": "Dask autoscaler is used for the dask clusters", + "value": "False" + }, "dask_cluster_default_cores_limit": { "title": "Default cores limit for dask clusters", "value": "4" @@ -318,6 +330,10 @@ def info(user, **kwargs): # noqa ), ) if DASK_ENABLED: + cluster_information["dask_autoscaler_enabled"] = dict( + title="Dask autoscaler is used for the dask clusters", + value=bool(DASK_AUTOSCALER_ENABLED), + ) cluster_information["dask_cluster_default_cores_limit"] = dict( title="Default cores limit for dask clusters", value=REANA_DASK_CLUSTER_DEFAULT_CORES_LIMIT, @@ -388,6 +404,7 @@ class InfoSchema(Schema): kubernetes_max_memory_limit = fields.Nested(StringInfoValue) dask_enabled = fields.Nested(StringInfoValue) if DASK_ENABLED: + dask_autoscaler_enabled = fields.Nested(StringInfoValue) dask_cluster_default_cores_limit = fields.Nested(StringInfoValue) dask_cluster_max_cores_limit = fields.Nested(StringInfoValue) dask_cluster_default_memory_limit = fields.Nested(StringInfoValue)