Functions
func DescribeScope(baseDirs []string, projectFilter string) string
DescribeScope names the listed state directories, and the project when one
was selected, for messages.
func LatestStart(baseDirs []string, now time.Time) (latest time.Time, ok bool)
LatestStart is the latest run start, by run ID, among the runs in baseDirs
that started before now, read from directory names alone; ok is false when
there is none.
Types
type Details struct {
WorkingDirectory string
Host string
// Sources are the recorded repositories' labels (model.SourceLabel).
Sources []string
// NoteCount counts the run's own notes, not its jobs'; FirstNote is the
// first line of the earliest.
NoteCount int
FirstNote string
// StartedBy is how the run was started, nil when not recorded.
StartedBy *model.StartedBy
}
Details are the facts shown beside a listed run, read from its context,
sources, and notes files: where it ran, which code it ran, and what was
noted about it. A file the run did not write leaves its facts empty.
func ReadDetails(run Run) (Details, error)
ReadDetails reads run's details. Callers read them only for the runs they
show, so listing many old runs stays cheap.
type Run struct {
BaseDir string
Project string
RunID string
RunName string
// Lifecycle is runview.RunLifecycleLabel: running, interrupted,
// incomplete, finished, or failed.
Lifecycle string
// HeartbeatWarning is runview.HeartbeatWarning for a running run.
HeartbeatWarning string
ClientStatus model.RunClientStatus
ClientLabel string
// ExitCode is nil until the run has a summary.
ExitCode *int
// StartedAt and FinishedAt are as recorded (RFC 3339), empty when
// unknown; Started and Finished are their parsed times.
StartedAt string
FinishedAt string
Started time.Time
Finished time.Time
// Order sorts runs newest first: the start time, or the run
// directory's modification time when the start is unknown.
Order int64
}
Run is one listed run.
func Collect(baseDirs []string, projectFilter string) ([]Run, error)
Collect lists the runs of every project in baseDirs, or of projectFilter
only, newest first. A projectFilter found in none of them is an error,
unless no basedir has any project.
func CollectBetween(baseDirs []string, projectFilter string, from, to time.Time) ([]Run, error)
CollectBetween is Collect for the runs whose span may meet [from, to),
as Overlapping decides; callers still apply Overlapping. It skips, without
reading their files, runs whose run ID says they started at or after to and
runs whose directory last changed before from (a run writes its summary
there when it ends), except the project's running or interrupted run.
A run whose ID is not a timestamp is judged by its directory's time alone.
func Overlapping(runs []Run, from, to, now time.Time) []Run
Overlapping keeps the runs whose span meets the range [from, to).
func Recent(runs []Run, cutoff time.Time) []Run
Recent keeps the runs `rotari runs` shows: running, interrupted, and
incomplete runs, runs with no recorded finish, and runs that finished at or
after cutoff.
func (run Run) Span(now time.Time) (start, end time.Time, ok bool)
Span is when run occupied its project: from its start to its finish, or to
now while it is running. A run that is not running and recorded no finish
(interrupted or incomplete) ends where it started. ok is false when the run
recorded no start.