diff --git a/components/renku_data_services/notebooks/blueprints.py b/components/renku_data_services/notebooks/blueprints.py index 12828ea00..74eaf1c37 100644 --- a/components/renku_data_services/notebooks/blueprints.py +++ b/components/renku_data_services/notebooks/blueprints.py @@ -266,7 +266,6 @@ async def _handler( if default_resource_class.id is None: raise errors.ProgrammingError(message="The default resource class has to have an ID", quiet=True) resource_class_id: int - quota: str | None = None if body.resource_class_id is None: resource_class = await self.rp_repo.get_default_resource_class() # TODO: Add types for saved and unsaved resource class @@ -275,7 +274,6 @@ async def _handler( resource_class = await self.rp_repo.get_resource_class(user, body.resource_class_id) # TODO: Add types for saved and unsaved resource class resource_class_id = body.resource_class_id - quota = resource_class.quota await self.nb_config.crc_validator.validate_class_storage(user, resource_class_id, body.disk_storage) work_dir_fallback = PurePosixPath("/home/jovyan") work_dir = environment.working_directory or image_workdir or work_dir_fallback @@ -372,7 +370,7 @@ async def _handler( codeRepositories=[], hibernated=False, reconcileStrategy=ReconcileStrategy.whenFailedOrHibernated, - priorityClassName=quota, + priorityClassName=resource_class.quota, session=Session( image=image, urlPath=ui_path, diff --git a/components/renku_data_services/notebooks/core_sessions.py b/components/renku_data_services/notebooks/core_sessions.py index 51846b90c..ade9a327f 100644 --- a/components/renku_data_services/notebooks/core_sessions.py +++ b/components/renku_data_services/notebooks/core_sessions.py @@ -408,6 +408,9 @@ async def patch_session( patch.spec.tolerations = tolerations # Affinities patch.spec.affinity = node_affinity_from_resource_class(rc, nb_config.sessions.affinity_model) + # Priority class (if a quota is being used) + if rc.quota: + patch.spec.priorityClassName = rc.quota # If the session is being hibernated we do not need to patch anything else that is # not specifically called for in the request body, we can refresh things when the user resumes.