Skip to content

feat: allow renku jobs to run on spot instances - #1462

Open
wesjdj wants to merge 6 commits into
mainfrom
spot-jobs-priority
Open

wesjdj wants to merge 6 commits into
mainfrom
spot-jobs-priority

Conversation

@wesjdj

@wesjdj wesjdj commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds a preemptible flag on resource classes, so jobs in those classes can run on spot nodes and be evicted by sessions; also fixes #1422. Needs SwissDataScienceCenter/renku#4640 (data-tasks RBAC); retry on eviction is in SwissDataScienceCenter/amalthea#1237.

/deploy #notest amalthea-sessions=spot-jobs-disruption renku=spot-jobs-rbac

@RenkuBot

Copy link
Copy Markdown
Contributor

You can access the deployment of this PR at https://renku-ci-ds-1462.dev.renku.ch

@coveralls

coveralls commented Sep 30, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38225780506

Coverage decreased (-0.05%) to 85.215%

Details

  • Coverage decreased (-0.05%) from the base build.
  • Patch coverage: 29 uncovered changes across 4 files (92 of 121 lines covered, 76.03%).
  • 13 coverage regressions across 5 files.

Uncovered Changes

File Changed Covered %
bases/renku_data_services/data_tasks/task_defs.py 14 1 7.14%
components/renku_data_services/notebooks/api/classes/k8s_client.py 10 1 10.0%
components/renku_data_services/crc/db.py 60 55 91.67%
components/renku_data_services/notebooks/core_sessions.py 5 3 60.0%
Total (11 files) 121 92 76.03%

Coverage Regressions

13 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
components/renku_data_services/k8s/watcher/core.py 5 78.36%
components/renku_data_services/k8s/db.py 4 91.04%
components/renku_data_services/crc/blueprints.py 2 96.96%
components/renku_data_services/crc/core.py 1 79.04%
components/renku_data_services/base_api/misc.py 1 96.15%

Coverage Stats

Coverage Status
Relevant Lines: 34623
Covered Lines: 29504
Line Coverage: 85.22%
Coverage Strength: 1.48 hits per line

💛 - Coveralls

@wesjdj
wesjdj force-pushed the spot-jobs-priority branch from 1ac46d4 to a75df8f Compare October 15, 2026 08:47
Comment on lines +183 to +185
def pool_preemptible_priority_class_name(namespace: str, resource_pool_id: int) -> str:
"""Return the name of the priority class for the preemptible resource classes of a pool without a quota."""
return f"{namespace}-pool-{resource_pool_id}-preemptible"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be simpler to not allow preemptible when the parent resource pool has no quota?

example: true
Preemptible:
type: boolean
description: Whether sessions and jobs in this resource class can be preempted by resources in non-preemptible resource classes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Whether sessions and jobs in this resource class can be preempted by resources in non-preemptible resource classes
description: Whether sessions and jobs in this resource class can be preempted by other workloads

Also, can apps be run as preemptible?

Comment on lines +1914 to +1915
SESSION_PRIORITY_VALUE = 100
PREEMPTIBLE_PRIORITY_VALUE = -5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicer: move these to constants.py and add a short docstring.

Comment on lines +1306 to +1307
labels["renku.io/preemptible"] = str(resource_class.preemptible).lower()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to when labels is created (L1292).

Comment on lines +1086 to +1089
if resource_class.preemptible:
await rp_repo.quotas_repo.ensure_preemptible_priority_class(
resource_pool.id, resource_class.quota, resource_pool.get_cluster_id()
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating the priority class should not happen at session start or session patch.

Suggested change
if resource_class.preemptible:
await rp_repo.quotas_repo.ensure_preemptible_priority_class(
resource_pool.id, resource_class.quota, resource_pool.get_cluster_id()
)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-default resource pool PriorityClasses do not evict capacity reservation pods

4 participants