Documentation
¶
Overview ¶
Package jobspec reads what a job's WORKER.md says about when and where it runs: its schedule (plain text or cron, in a time zone), where it runs (here, on the computer, or on the organization's service), what to do about missed times and its time limit. Blitz's workers and the organization's service read jobs with it alike.
Index ¶
Constants ¶
const ( // Here is on the person's computer, while Blitz's service runs. Here = "here" // Service is on the organization's service, at every time. Service = "service" )
Where a job runs (spec_053_enterprise EN-40).
const ( // MergeMain adds them to the workspace's main too when they merge // cleanly: the default. MergeMain = "main" // MergeNever keeps them on the run's branch, for someone to add. MergeNever = "never" )
Where a run on the service leaves its changes (blitz-enterprise spec_009_jobs JB-10): each goes to its own branch first.
const FileName = "WORKER.md"
FileName is the file that defines a job, in its own directory.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Schedule ¶
type Schedule struct {
// Text is the schedule as written.
Text string
// Cron is how it was understood: a five-field cron expression, or a
// descriptor ("@hourly", "@every 90m").
Cron string
Location *time.Location
// contains filtered or unexported fields
}
Schedule is when a worker runs.
func ParseSchedule ¶
ParseSchedule understands a cron expression, a descriptor, or plain text ("Every two hours", "Daily at 6 AM", "Weekdays at 9:30", "Every Monday at 8 PM") in the time zone named tz ("" for the machine's). Plain text is translated by fixed rules, never guessed: anything else is an error.
type Spec ¶
type Spec struct {
Description string
// Schedule is as written; empty for a job run only on request.
Schedule, Timezone string
// RunsOn is Here or Service.
RunsOn string
// CatchUp is "none" or "once".
CatchUp string
// Timeout is a run's time limit (0: the runner's default).
Timeout time.Duration
// Merge is where a run on the service leaves its changes: MergeMain or
// MergeNever.
Merge string
}
Spec is when and where a job runs.