Class: Rubino::API::Operations::Runs::StopOperation
- Inherits:
-
Object
- Object
- Rubino::API::Operations::Runs::StopOperation
- Defined in:
- lib/rubino/api/operations/runs/stop_operation.rb
Overview
POST /v1/runs/:id/stop Cooperative stop: flags the run for cancellation; the executor checks between turns and exits cleanly. Returns 200 immediately — the run may still take a turn to wind down.
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(repository: nil) ⇒ StopOperation
constructor
Accepts an alternate repository for tests.
Constructor Details
#initialize(repository: nil) ⇒ StopOperation
Accepts an alternate repository for tests.
15 16 17 |
# File 'lib/rubino/api/operations/runs/stop_operation.rb', line 15 def initialize(repository: nil) @repository = repository || ::Rubino::Run::Repository.new end |
Instance Method Details
#call(request) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rubino/api/operations/runs/stop_operation.rb', line 19 def call(request) id = request.params.fetch("id") raise NotFoundError.new("run", id) unless @repository.find(id) @repository.request_stop!(id) [200, { id: id, status: "stop_requested" }] end |