Skip to content

Commit

Permalink
fix: set priority class in patches
Browse files Browse the repository at this point in the history
  • Loading branch information
olevski committed Dec 24, 2024
1 parent b7c46f0 commit 2ee8fcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions components/renku_data_services/notebooks/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions components/renku_data_services/notebooks/core_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2ee8fcd

Please sign in to comment.