[PR #6739] [MERGED] add "stop" command #12212

Closed
opened 2026-04-12 23:52:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/6739
Author: @pdevine
Created: 9/11/2024
Status: Merged
Merged: 9/11/2024
Merged by: @pdevine

Base: mainHead: pdevine/stop


📝 Commits (2)

📊 Changes

5 files changed (+172 additions, -25 deletions)

View changed files

📝 cmd/cmd.go (+54 -2)
📝 cmd/interactive.go (+1 -22)
📝 server/routes.go (+52 -0)
📝 server/sched.go (+19 -1)
📝 server/sched_test.go (+46 -0)

📄 Description

This change adds the ollama stop <model> command which can be used to stop a running model. This is triggered by a call to /api/generate with an empty prompt and duration 0, or to /api/chat with empty messages and duration 0. The model will expire, but won't force being unloaded until any currently running instances have finished inference. When it's in this state it will show Stopping... in ollama ps to show that it's about to stop.

In the future we can add a force argument to immediately unload a model and stop all inference, but that's beyond the scope of this change.

Fixes #6738 #4764
Supercedes #5328


🔄 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/6739 **Author:** [@pdevine](https://github.com/pdevine) **Created:** 9/11/2024 **Status:** ✅ Merged **Merged:** 9/11/2024 **Merged by:** [@pdevine](https://github.com/pdevine) **Base:** `main` ← **Head:** `pdevine/stop` --- ### 📝 Commits (2) - [`0fbe7df`](https://github.com/ollama/ollama/commit/0fbe7df8ce352c271202106e8598fe538401b245) add "stop" command - [`dfaf43c`](https://github.com/ollama/ollama/commit/dfaf43c00c30fa4896a3be744a5605766f151e31) comments ### 📊 Changes **5 files changed** (+172 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+54 -2) 📝 `cmd/interactive.go` (+1 -22) 📝 `server/routes.go` (+52 -0) 📝 `server/sched.go` (+19 -1) 📝 `server/sched_test.go` (+46 -0) </details> ### 📄 Description This change adds the `ollama stop <model>` command which can be used to stop a running model. This is triggered by a call to `/api/generate` with an empty prompt and duration 0, or to `/api/chat` with empty messages and duration 0. The model will *expire*, but won't force being unloaded until any currently running instances have finished inference. When it's in this state it will show `Stopping...` in `ollama ps` to show that it's about to stop. In the future we can add a _force_ argument to immediately unload a model and stop all inference, but that's beyond the scope of this change. Fixes #6738 #4764 Supercedes #5328 --- <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-12 23:52:08 -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#12212