Documentation ¶
Index ¶
- type Client
- func (c *Client) AddJob(job *Job) (*Job, error)
- func (c *Client) AddSchedule(jobID string, schedule *Schedule) (*Schedule, error)
- func (c *Client) Job(jobID string, opts ...JobsOption) (*Job, error)
- func (c *Client) Jobs(opts ...JobsOption) ([]Job, error)
- func (c *Client) Kill(jobID, runID string) error
- func (c *Client) Queued(jobID string) ([]Queue, error)
- func (c *Client) RemoveJob(jobID string, force bool) error
- func (c *Client) RemoveSchedule(jobID, scheduleID string) error
- func (c *Client) Run(jobID, runID string) (*Run, error)
- func (c *Client) RunJob(jobID string) (*Run, error)
- func (c *Client) Runs(jobID string) ([]Run, error)
- func (c *Client) Schedules(jobID string) ([]Schedule, error)
- func (c *Client) UpdateJob(job *Job) (*Job, error)
- func (c *Client) UpdateSchedule(jobID string, schedule *Schedule) (*Schedule, error)
- type Error
- type Job
- type JobHistory
- type JobHistorySummary
- type JobsOption
- type Queue
- type Run
- type Schedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for Cosmos.
func NewClient ¶
func NewClient(baseClient *httpclient.Client, logger *logrus.Logger) *Client
NewClient creates a new Metronome client.
func (*Client) AddSchedule ¶
AddSchedule adds a schedule to the job with the given jobID.
func (*Client) Job ¶
func (c *Client) Job(jobID string, opts ...JobsOption) (*Job, error)
Job returns a Job for the given jobID.
func (*Client) Jobs ¶
func (c *Client) Jobs(opts ...JobsOption) ([]Job, error)
Jobs returns a list of all job definitions.
func (*Client) RemoveSchedule ¶
RemoveSchedule removes a schedule from a job with the given jobID and scheduleID.
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Details []detail `json:"details"` }
Error is a standard error returned by the DC/OS API.
type Job ¶
type Job struct { ID string `json:"id"` Dependencies []dependency `json:"dependencies,omitempty"` Description string `json:"description"` Labels map[string]string `json:"labels,omitempty"` // The run property of a Job represents the run configuration for that Job Run struct { Args []string `json:"args,omitempty"` Artifacts []artifact `json:"artifacts,omitempty"` Cmd string `json:"cmd"` Cpus float32 `json:"cpus"` Gpus float32 `json:"gpus"` Disk int `json:"disk"` Docker *docker `json:"docker,omitempty"` Env map[string]interface{} `json:"env,omitempty"` MaxLaunchDelay int `json:"maxLaunchDelay,omitempty"` Mem int `json:"mem"` Placement *placement `json:"placement,omitempty"` Secrets map[string]interface{} `json:"secrets,omitempty"` TaskKillGracePeriodSeconds float64 `json:"taskKillGracePeriodSeconds"` UCR *ucr `json:"ucr,omitempty"` User string `json:"user,omitempty"` Restart *restart `json:"restart,omitempty"` Volumes []volume `json:"volumes,omitempty"` } `json:"run"` // These properties depend on the embed parameters when querying the /v1/jobs endpoints. ActiveRuns []Run `json:"activeRuns,omitempty"` HistorySummary *JobHistorySummary `json:"historySummary,omitempty"` History *JobHistory `json:"history,omitempty"` Schedules []Schedule `json:"schedules,omitempty"` }
Job represents a Job returned by the Metronome API.
func (*Job) LastRunStatus ¶
LastRunStatus returns the status of the last run of this job.
type JobHistory ¶
type JobHistory struct { SuccessCount int `json:"successCount"` FailureCount int `json:"failureCount"` LastSuccessAt string `json:"lastSuccessAt"` LastFailureAt string `json:"lastFailureAt"` SuccessfulFinishedRuns []runHistory `json:"successfulFinishedRuns"` FailedRuns []runHistory `json:"failedFinishedRuns"` }
JobHistory contains statistics and information about past runs of a Job.
type JobHistorySummary ¶
type JobHistorySummary struct { SuccessCount int `json:"successCount"` FailureCount int `json:"failureCount"` LastSuccessAt string `json:"lastSuccessAt"` LastFailureAt string `json:"lastFailureAt"` }
JobHistorySummary contains statistics about past runs of a Job.
type JobsOption ¶
JobsOption is a functional Option to set the `embed` query parameters.
func EmbedActiveRun ¶
func EmbedActiveRun() JobsOption
EmbedActiveRun sets the `embed` option to activeRuns.
func EmbedHistorySummary ¶
func EmbedHistorySummary() JobsOption
EmbedHistorySummary sets the `embed` option to historySummary.
func EmbedSchedule ¶
func EmbedSchedule() JobsOption
EmbedSchedule sets the `embed` option to schedules.
type Queue ¶
type Queue struct { JobID string `json:"jobId"` Runs []queuedRun `json:"runs"` }
Queue contains all queued runs of a Job.
type Run ¶
type Run struct { ID string `json:"id"` JobID string `json:"jobId"` Status string `json:"status"` CreatedAt string `json:"createdAt"` CompletedAt string `json:"completedAt"` Tasks []activeTask `json:"tasks"` }
Run contains information about a run of a Job.
type Schedule ¶
type Schedule struct { ID string `json:"id"` Cron string `json:"cron"` TimeZone string `json:"timeZone,omitempty"` StartingDeadlineSeconds int `json:"startingDeadlineSeconds,omitempty"` ConcurrencyPolicy string `json:"concurrencyPolicy"` Enabled bool `json:"enabled"` NextRunAt string `json:"nextRunAt"` }
Schedule of a Job.