[PR #13675] feat: prevent system sleep during active inference (macOS) #40204

Open
opened 2026-04-23 01:09:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13675
Author: @biplavbarua
Created: 1/11/2026
Status: 🔄 Open

Base: mainHead: feature/prevent-sleep


📝 Commits (1)

  • 8b31ced feat: prevent system sleep during active inference (macOS)

📊 Changes

5 files changed (+139 additions, -0 deletions)

View changed files

server/internal/power/power.go (+11 -0)
server/internal/power/power_darwin.go (+44 -0)
server/internal/power/power_default.go (+11 -0)
server/internal/power/power_test.go (+42 -0)
📝 server/sched.go (+31 -0)

📄 Description

This PR implements system sleep prevention on macOS during active inference tasks. It introduces a new server/internal/power package that uses IOKit to assert a kIOPMAssertionTypeNoIdleSleep when the scheduler has active requests. This fixes #4072 by ensuring long-running model loads or generations are not interrupted by system sleep.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13675 **Author:** [@biplavbarua](https://github.com/biplavbarua) **Created:** 1/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/prevent-sleep` --- ### 📝 Commits (1) - [`8b31ced`](https://github.com/ollama/ollama/commit/8b31ced0b67a31b52e394a0ec9161566714694f1) feat: prevent system sleep during active inference (macOS) ### 📊 Changes **5 files changed** (+139 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `server/internal/power/power.go` (+11 -0) ➕ `server/internal/power/power_darwin.go` (+44 -0) ➕ `server/internal/power/power_default.go` (+11 -0) ➕ `server/internal/power/power_test.go` (+42 -0) 📝 `server/sched.go` (+31 -0) </details> ### 📄 Description This PR implements system sleep prevention on macOS during active inference tasks. It introduces a new `server/internal/power` package that uses `IOKit` to assert a `kIOPMAssertionTypeNoIdleSleep` when the scheduler has active requests. This fixes #4072 by ensuring long-running model loads or generations are not interrupted by system sleep. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:09:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#40204