package module
Version: v0.0.0-...-2e4feba Latest Latest

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

Go to latest
Published: Jan 23, 2018 License: Apache-2.0 Imports: 2 Imported by: 2


Build Status Go Report Card Taylor Swift Volkswagen License


go-chronos is a Go library for the Chronos REST API. Check the examples to see how to access the Chronos API.


  • Creating Jobs
  • Deleting Jobs
  • Search Jobs
  • Kill Tasks
  • List Jobs
  • Marking a Job as successful


You can find the documentation hosted on


go get


You find some examples in the examples folder.


Install neat tools and dependencies.

make deps && make restore


Apache 2.0



Package chronos provides a Client for the Chronos REST API.



View Source
const (
	// ChronosAPI is a constant representing the Chronos REST API entrypoint
	ChronosAPI = "v1/scheduler/"
	// ChronosAPIJobs is a constant representing the jobs resource
	ChronosAPIJobs = "jobs"
	// ChronosAPIJobsSearch is a constant representing the search resource
	ChronosAPIJobsSearch = "jobs/search"
	// ChronosAPIJob is a constant representing the job resource
	ChronosAPIJob = "job/"
	// ChronosAPIJobTaskKill is a constant representing the task resource
	ChronosAPIJobTaskKill = "task/kill/"
	// ChronosAPIJobSuccess is a constant representing the jobs success resource
	ChronosAPIJobSuccess = "success/"
	// ChronosAPIIso8601 is a constant representing the spec for date format
	ChronosAPIIso8601 = "iso8601"


This section is empty.


This section is empty.


type Argument

type Argument string

Argument contains an job argument

type Client

type Client struct {

	// Chronos API
	Jobs *JobsService
	Job  *JobService
	// contains filtered or unexported fields

Client is a Chronos client for making Chronos API requests

func New

func New(chronosURL string, httpClient *http.Client) *Client

New returns a new Client. If you provide an URL. For example,#

chronosURL := "https://localhost"
httpClient := &http.Client{}
chronosClient := chronos.New(chronosURL, httpClient)

chronosURL: is the URL of your Chronos with a slash at the end.

type Constraint

type Constraint []string

Constraint contains a string tuple in the form ["LHS", "Comparator", "RHS"]

type Container

type Container struct {
	Type           string        `json:"type,omitempty"`
	Image          string        `json:"image,omitempty"`
	ForcePullImage bool          `json:"forcePullImage, omitempty"`
	Network        string        `json:"network,omitempty"`
	NetworkName    string        `json:"networkName,omitempty"`
	NetworkInfos   []NetworkInfo `json:"networkInfos,omitempty"`
	Volumes        []Volume      `json:"volumes,omitempty"`
	Parameters     []Parameter   `json:"parameters,omitempty"`

Container contains a Mesos container description

type EnvironmentVariable

type EnvironmentVariable struct {
	Key   string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`

EnvironmentVariable contains a single env kv pair

type Error

type Error struct {

Error contains an error from Chronos API

type ExternalVolume

type ExternalVolume struct {
	Name     string      `json:"name"`
	Provider string      `json:"provider,omitempty"`
	Options  []Parameter `json:"options,omitempty"`

ExternalVolume contains external volume specification

type Fetch

type Fetch struct {
	URI        string `json:"uri,omitempty"`
	Cache      bool   `json:"cache,omitempty"`
	Extract    bool   `json:"extract,omitempty"`
	Executable bool   `json:"executable,omitempty"`
	OutputFile string `json:"output_file,omitempty"`

Fetch contains a remote executor fetch descriptor

type Job

type Job struct {
	Name                   string                `json:"name"`
	Command                string                `json:"command"`
	Shell                  bool                  `json:"shell,omitempty"`
	Epsilon                string                `json:"epsilon,omitempty"`
	Executor               string                `json:"executor,omitempty"`
	ExecutorFlags          string                `json:"executorFlags,omitempty"`
	Retries                int                   `json:"retries,omitempty"`
	Owner                  string                `json:"owner,omitempty"`
	OwnerName              string                `json:"ownerName,omitempty"`
	Description            string                `json:"description,omitempty"`
	Async                  bool                  `json:"async,omitempty"`
	SuccessCount           int                   `json:"successCount,omitempty"`
	ErrorCount             int                   `json:"errorCount,omitempty"`
	LastSuccess            string                `json:"lastSuccess,omitempty"`
	LastError              string                `json:"lastError,omitempty"`
	CPUs                   float64               `json:"cpus,omitempty"`
	Disk                   float64               `json:"disk,omitempty"`
	Mem                    float64               `json:"mem,omitempty"`
	Disabled               bool                  `json:"disabled,omitempty"`
	Concurrent             bool                  `json:"concurrent,omitempty"`
	SoftError              bool                  `json:"softError,omitempty"`
	FetchList              []Fetch               `json:"fetch,omitempty"`
	DataProcessingJobType  bool                  `json:"dataProcessingJobType,omitempty"`
	ErrorsSinceLastSuccess int                   `json:"errorsSinceLastSuccess,omitempty"`
	URIs                   []string              `json:"uris,omitempty"`
	EnvironmentVariables   []EnvironmentVariable `json:"environmentVariables,omitempty"`
	Arguments              []Argument            `json:"arguments,omitempty"`
	HighPriority           bool                  `json:"highPriority,omitempty"`
	RunAsUser              string                `json:"runAsUser,omitempty"`
	Container              *Container            `json:"container,omitempty"`
	Schedule               string                `json:"schedule,omitempty"`
	ScheduleTimeZone       string                `json:"scheduleTimeZone,omitempty"`
	Constraints            []Constraint          `json:"constraints,omitempty"`
	Parents                []string              `json:"parents,omitempty"`
	TaskInfoData           string                `json:"taskInfoData,omitempty"`

Job contains a Chronos jobs description

type JobService

type JobService struct {
	// contains filtered or unexported fields

JobService provides methods for Chronos job operations

func (*JobService) Delete

func (j *JobService) Delete(job string) (bool, *http.Response, error)

Delete is deleting a job job: is the name of the job to delete

func (*JobService) KillAllTasks

func (j *JobService) KillAllTasks(job string) (bool, *http.Response, error)

KillAllTasks is killing all related tasks for a job job: is the name of the job of whoms tasks to be killed

func (*JobService) MarkSuccess

func (j *JobService) MarkSuccess(job string) (bool, *http.Response, error)

MarkSuccess is marking a job as successful job: is the name of the job to mark as success

func (*JobService) New

func (j *JobService) New(job *Job) (bool, *http.Response, error)

New is adding a new job in chronos

func (*JobService) Start

func (j *JobService) Start(job string, params *JobStartParams) (bool, *http.Response, error)

Start is manually starting a job job: is the name of the job to start params: are the parameters of the job to start

type JobStartParams

type JobStartParams struct {
	Arguments Argument `url:"arguments,omitempty"`

JobStartParams contains the parameters to start a job

type Jobs

type Jobs []Job

Jobs contains a multitude of Job

type JobsSearchParams

type JobsSearchParams struct {
	Name    string `url:"name,omitempty"`
	Command string `url:"command,omitempty"`
	Any     string `url:"any,omitempty"`

JobsSearchParams is the parameters for job search

type JobsService

type JobsService struct {
	// contains filtered or unexported fields

JobsService provices methods for Chronos jobs operations

func (*JobsService) List

func (j *JobsService) List() (*[]Job, *http.Response, error)

List returns the list of jobs

func (*JobsService) Search

func (j *JobsService) Search(params *JobsSearchParams) (*[]Job, *http.Response, error)

Search is searching for a job in Chronos params: are the search parameters for the job

type NetworkInfo

type NetworkInfo struct {
	Name         string        `json:"name"`
	Protocol     string        `json:"protocol,omitempty"`
	Labels       []Parameter   `json:"labels,omitempty"`
	PortMappings []PortMapping `json:"portMappings,omitempty"`

NetworkInfo contains container infos to NetworkInfo

type Parameter

type Parameter struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`

Parameter contains information about parameter

type PortMapping

type PortMapping struct {
	HostPort      int    `json:"hostPort,omitempty"`
	ContainerPort int    `json:"containerPort,omitempty"`
	Protocol      string `json:"protocol,omitempty"`

PortMapping contains a port map and protocol specifications

type Volume

type Volume struct {
	HostPath      string          `json:"hostPath,omitempty"`
	ContainerPath string          `json:"containerPath,omitempty"`
	Mode          string          `json:"mode,omitempty"`
	External      *ExternalVolume `json:"external,omitempty"`

Volume contains information about a container volume


Path Synopsis

Jump to

Keyboard shortcuts

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