jobcontrol

package
v0.1.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jobcontrol cancels, suspends, and resumes a project's running jobs.

It finds the running run through the project's run lock, resolves job and attempt selections against it, and signals each job through the executor that owns it. It refuses to signal local processes from a host other than the one that started them. It should not decide run planning or finalization; a cancelled run finalizes through the normal run path.

Index

Constants

View Source
const (
	StateRunning = "running"
	StatePending = "pending"
)

Job states that Selection.States names.

Variables

View Source
var States = map[string][]string{
	"cancel":  {StateRunning, StatePending},
	"suspend": {StateRunning},
	"resume":  {StateRunning},
}

States are the job states each operation acts on: cancel reaches pending jobs too, and suspend and resume only running ones.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Store     state.Store
	Executors executor.Registry
}

Controller signals jobs through a registry of executors.

func (Controller) Cancel

func (controller Controller) Cancel(baseDir, project, runID string, jobIDs []string, wait bool) (string, error)

Cancel cancels the selected running jobs of project in baseDir, or its whole run when jobIDs is empty. A non-empty runID must be the project's active run, and an array job's ID selects its unfinished tasks. A whole-run cancel marks the queue as cancelling and cancels each unfinished job directly, whichever process calls it. With wait, it returns once the run lock is released.

func (Controller) CancelJobs

func (controller Controller) CancelJobs(runDir, project, runID string, jobIDs []string) (string, error)

CancelJobs cancels jobIDs in runDir through their owning executors. A job that was never submitted is marked cancelled so the run skips it.

func (Controller) Control

func (controller Controller) Control(baseDir, project, runID string, jobIDs []string, operation string) (string, error)

Control suspends or resumes, as named by operation, the selected running jobs of project in baseDir, or every running job when jobIDs is empty. A non-empty runID must be the project's active run. Attempt IDs must name the latest attempt of a running job, and an array job's ID selects its running tasks.

func (Controller) Select

func (controller Controller) Select(baseDir, project, runID string, selection Selection, now time.Time) (string, []string, error)

Select resolves project's active run, which must be runID when runID is not empty, and returns its ID and the sorted IDs of its unfinished jobs, array tasks one by one, that selection chooses. Durations of running jobs end at now. It fails when a name matches no job of the run or no job matches.

type Selection

type Selection struct {
	Names  []string
	Scope  model.CommandSelector
	Filter jobfilter.Filter
	States []string
}

Selection chooses unfinished jobs of a run by job name or by filters. Names select jobs whose name, or whose command's name, is one of them. Scope, Filter, and States narrow further; a job is running once its executor owns it and pending before, and empty States allow both.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL