From ac1a9bea7ea8d18f91a7494290626ec08bc97d26 Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Tue, 5 Nov 2024 11:02:13 -0500 Subject: [PATCH 1/3] feat: add autoscaling values for ralph and superset --- README.rst | 8 +++++++ tutoraspects/filters.py | 49 +++++++++++++++++++++++++++++++++++++++++ tutoraspects/plugin.py | 8 +++++++ 3 files changed, 65 insertions(+) create mode 100644 tutoraspects/filters.py diff --git a/README.rst b/README.rst index 1395f4ca0..6ddf8bd01 100644 --- a/README.rst +++ b/README.rst @@ -97,6 +97,14 @@ At this point you should have a working Tutor / Aspects environment, but with no You should now have data to look at in Superset! Log in to https://superset.local.overhang.io/ with your admin account and you should see charts with your data. +Aspects Autoscaling +------------------- + +Aspects adds default autoscaling values for `Ralph`, `Superset` and the `Superset Worker` deployments via +`tutor-contrib-pod-autoscaling `_. To apply the +autoscaling settings make sure to install the plugin and enable it. To modify the autoscaling values +see the `Configuration `_ section. + Superset Assets --------------- diff --git a/tutoraspects/filters.py b/tutoraspects/filters.py new file mode 100644 index 000000000..227db2980 --- /dev/null +++ b/tutoraspects/filters.py @@ -0,0 +1,49 @@ +"""Filters usage.""" + +from tutorpod_autoscaling.hooks import AUTOSCALING_CONFIG + + +@AUTOSCALING_CONFIG.add() +def add_aspects_autoscaling(autoscaling_config): + """Add autoscaling values for Aspects services.""" + autoscaling_config.update( + { + "ralph": { + "enable_hpa": True, + "memory_request": "300Mi", + "cpu_request": 0.25, + "memory_limit": "600Mi", + "cpu_limit": 1, + "min_replicas": 1, + "max_replicas": 10, + "avg_cpu": 80, + "avg_memory": "", + "enable_vpa": False, + }, + "superset": { + "enable_hpa": True, + "memory_request": "500Mi", + "cpu_request": 0.25, + "memory_limit": "1000Mi", + "cpu_limit": 1, + "min_replicas": 1, + "max_replicas": 10, + "avg_cpu": 80, + "avg_memory": "", + "enable_vpa": False, + }, + "superset-worker": { + "enable_hpa": True, + "memory_request": "600Mi", + "cpu_request": 0.25, + "memory_limit": "1500Mi", + "cpu_limit": 1, + "min_replicas": 1, + "max_replicas": 10, + "avg_cpu": 80, + "avg_memory": "", + "enable_vpa": False, + }, + } + ) + return autoscaling_config diff --git a/tutoraspects/plugin.py b/tutoraspects/plugin.py index aeb89ba88..44974b3cf 100644 --- a/tutoraspects/plugin.py +++ b/tutoraspects/plugin.py @@ -636,3 +636,11 @@ def _aspects_public_hosts( # file for now. for f in TUTOR_V1_COMMANDS: hooks.Filters.CLI_COMMANDS.add_item(f) + +# Autoscaling +try: + from tutoraspects.filters import ( # pylint: disable=unused-import + add_aspects_autoscaling, + ) +except ImportError: + pass From 4ca0ec3323b152de5458ec921fd981a8669f209e Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Wed, 6 Nov 2024 11:08:08 -0500 Subject: [PATCH 2/3] chore: add pod-autoscaling as a dev requirement --- requirements/dev.in | 1 + tutoraspects/filters.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements/dev.in b/requirements/dev.in index 985b9c3dd..51a5bd011 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -4,3 +4,4 @@ black pyinstaller pylint twine +git+https://github.com/edunext/tutor-contrib-pod-autoscaling diff --git a/tutoraspects/filters.py b/tutoraspects/filters.py index 227db2980..88ffd7b67 100644 --- a/tutoraspects/filters.py +++ b/tutoraspects/filters.py @@ -1,6 +1,8 @@ """Filters usage.""" -from tutorpod_autoscaling.hooks import AUTOSCALING_CONFIG +from tutorpod_autoscaling.hooks import ( # pylint: disable=import-error + AUTOSCALING_CONFIG, +) @AUTOSCALING_CONFIG.add() From f7e05a909fde471496e3f1443f0fd68f3c655aea Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Wed, 6 Nov 2024 11:36:43 -0500 Subject: [PATCH 3/3] chore: pin pod-autoscaling plugin --- requirements/dev.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.in b/requirements/dev.in index 51a5bd011..7495aca5d 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -4,4 +4,4 @@ black pyinstaller pylint twine -git+https://github.com/edunext/tutor-contrib-pod-autoscaling +git+https://github.com/edunext/tutor-contrib-pod-autoscaling@18.0.1