joblist

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: 13 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 joblist lists recent job attempts across a base directory's projects: running jobs of active runs and jobs that finished within a time window.

`rotari jobs` and the Web UI's jobs page share it. Row status comes from internal/jobstatus; this package decides which attempts are listed and in what order, and how their times read. Column selection and table layout belong to the callers.

Index

Constants

View Source
const (
	// DefaultSince is the listing window when none is given.
	DefaultSince = 24 * time.Hour
	// DefaultSinceText is DefaultSince as users write it.
	DefaultSinceText = "1d"
)

Variables

This section is empty.

Functions

func FormatElapsed

func FormatElapsed(value time.Duration) string

FormatElapsed formats a duration as "42s", "3m 05s", or "2h 07m", and a negative one as "-".

func FormatLocalTimestamp

func FormatLocalTimestamp(value time.Time) string

FormatLocalTimestamp is FormatTimestamp without the time zone.

func FormatRunTime

func FormatRunTime(runTime jobstatus.RunTime) string

FormatRunTime formats a job's elapsed time and, while it runs, how long ago it last wrote output: "12m 03s, quiet 11m 58s", or "12m 03s, no output" when it has written none.

func FormatTimestamp

func FormatTimestamp(value time.Time) string

FormatTimestamp formats a listing time in time.Local with the zone name, matching the other web pages.

func ParseSince

func ParseSince(value string) (time.Duration, error)

ParseSince parses a listing window: a Go duration such as "24h" or "90m", or a whole number of days such as "7d", which Go durations lack. Empty means DefaultSince.

func Projects

func Projects(baseDir, requested string) ([]string, error)

Projects returns requested, or every project in baseDir sorted by name, or the default project when baseDir has none.

func ShortenText

func ShortenText(value string, maxLength int) string

ShortenText cuts value to maxLength bytes, ending with "..." when maxLength leaves room for it.

func Sort

func Sort(rows []Row)

Sort orders rows by finish time, or start time for unfinished jobs, newest first. A row without either, such as a pending job, is listed right after the newest row of its run, so a run's jobs stay together.

Types

type Interval added in v0.1.21

type Interval struct {
	Start time.Time
	End   time.Time
}

Interval is a span of finish times from Start up to, but not including, End. A zero End leaves the span open.

type Row

type Row struct {
	State       string
	BaseDir     string
	Project     string
	RunID       string
	JobID       string
	AttemptID   string
	JobName     string
	Command     string
	FullCommand string
	StartedAt   time.Time
	FinishedAt  time.Time
	jobstatus.RunTime
}

Row is one job in the listing: an unfinished attempt of an active or interrupted run, a job of such a run that has not started (with no AttemptID), or a job that finished inside the window.

func Collect

func Collect(store state.Store, baseDir string, projects []string, now time.Time, window time.Duration) ([]Row, error)

Collect lists unfinished attempts and jobs of projects in baseDir that finished within window before now. Each job's status follows the internal/jobstatus fallback chain.

func CollectFinishedIn added in v0.1.21

func CollectFinishedIn(store state.Store, baseDir string, projects []string, now time.Time, spans []Interval) ([]Row, error)

CollectFinishedIn is Collect for jobs that finished inside any of spans rather than one window before now. Unfinished jobs are listed regardless.

Jump to

Keyboard shortcuts

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