Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigLogging(cfg *Config)
- func InitLogging(sink io.Writer)
- func StartServer(cfg *Config) error
- type BackendConfig
- type BasicReply
- type Config
- type GetJobStatusReply
- type HTTPEndpoints
- type JobClient
- func (c *JobClient) Close()
- func (c *JobClient) GetJobStatus(ids []string, full bool, quit <-chan struct{}) (*GetJobStatusReply, error)
- func (c *JobClient) PostJobStatus(job *ProcessedJob) (*PostJobStatusReply, error)
- func (c *JobClient) PostNewJob(job *JobSpecification) (*PostNewJobReply, error)
- func (c *JobClient) SubscribeNewJobs(keyID string) (<-chan amqp.Delivery, error)
- func (c *JobClient) WaitForJobs(ids []string, timeout int) ([]JobStatus, error)
- type JobSpecification
- type JobStatus
- type PostJobStatusReply
- type PostNewJobReply
- type ProcessedJob
- type QueueClient
- type QueueConfig
- type RequestCancelled
- type ServerConfig
- type UnprocessedJob
- type Waiter
- type Worker
- type WorkerConfig
Constants ¶
const ( // ClientProfile is used by the submit and check commands ClientProfile = iota // ServerProfile is used by the server command ServerProfile // WorkerProfile is used by the worker command WorkerProfile )
const (
// SchemaVersion is the latest schema version of the job database
SchemaVersion = 1
)
Variables ¶
var Log zerolog.Logger
Log is the application-wide logger
Functions ¶
func ConfigLogging ¶
func ConfigLogging(cfg *Config)
ConfigLogging updates the logging settings with values from a Config object (Meant to be called after ReadConfig)
func StartServer ¶
StartServer starts the conveyor server component. This function will block until the server finishes.
Types ¶
type BackendConfig ¶
type BackendConfig struct { Type string Database string Username string Password string Host string Port int }
BackendConfig - database backend configuration for the conveyor job server DB backend
type BasicReply ¶
BasicReply is a status message and optional error cause
type Config ¶
type Config struct { JobWaitTimeout int `mapstructure:"job_wait_timeout"` Debug bool LogTimestamps bool `mapstructure:"log_timestamps"` Server ServerConfig Queue QueueConfig Backend BackendConfig Worker WorkerConfig }
Config - main configuration object
func ReadConfig ¶
ReadConfig - populate the config object using the global viper object and the config file, based on profile (client, worker, or server). The different sections may not needed in all profiles
func (*Config) HTTPEndpoints ¶
func (c *Config) HTTPEndpoints() HTTPEndpoints
HTTPEndpoints constructs an HTTPEndpoints object
type GetJobStatusReply ¶
type GetJobStatusReply struct { BasicReply IDs []JobStatus `json:",omitempty"` Jobs []ProcessedJob `json:",omitempty"` }
GetJobStatusReply is the return type of the GetJob query
type HTTPEndpoints ¶
type HTTPEndpoints struct {
// contains filtered or unexported fields
}
HTTPEndpoints holds the different HTTP end points of the conveyor job server
func (HTTPEndpoints) CompletedJobs ¶
func (o HTTPEndpoints) CompletedJobs(withBase bool) string
CompletedJobs returns the endpoint for completed jobs. If "withBase" is true, the base URL is prepended
func (HTTPEndpoints) NewJobs ¶
func (o HTTPEndpoints) NewJobs(withBase bool) string
NewJobs returns the endpoint for new jobs. If "withBase" is true, the base URL is prepended
type JobClient ¶
type JobClient struct {
// contains filtered or unexported fields
}
JobClient offers functionality for interacting with the job server
func NewJobClient ¶
NewJobClient constructs a new JobClient object using a configuration object and a set of keys
func (*JobClient) Close ¶
func (c *JobClient) Close()
Close all the internal connections of the object
func (*JobClient) GetJobStatus ¶
func (c *JobClient) GetJobStatus( ids []string, full bool, quit <-chan struct{}) (*GetJobStatusReply, error)
GetJobStatus queries the status of a set of jobs from the server
func (*JobClient) PostJobStatus ¶
func (c *JobClient) PostJobStatus(job *ProcessedJob) (*PostJobStatusReply, error)
PostJobStatus posts the status of a completed job to the server
func (*JobClient) PostNewJob ¶
func (c *JobClient) PostNewJob(job *JobSpecification) (*PostNewJobReply, error)
PostNewJob posts a new unprocessed job to the server
func (*JobClient) SubscribeNewJobs ¶
SubscribeNewJobs returns a channel with new job messages coming from the conveyor server
func (*JobClient) WaitForJobs ¶
WaitForJobs waits for the completion of a set of jobs referenced through theirs unique ids. The job status is obtained from the completed job notification channel of the job queue and from the job server
type JobSpecification ¶
type JobSpecification struct { JobName string Repository string Payload string LeasePath string Dependencies []string }
JobSpecification contains all the parameters of a new job which is to be submitted
func (*JobSpecification) Prepare ¶
func (spec *JobSpecification) Prepare()
Prepare a job specification for submission: normalizes the lease path and embeds the transaction script in the job description, if the script is a local file
type PostJobStatusReply ¶
type PostJobStatusReply struct {
BasicReply
}
PostJobStatusReply is the return value of the PutJobStatus action
type PostNewJobReply ¶
type PostNewJobReply struct { BasicReply ID uuid.UUID }
PostNewJobReply is the return type of the PostNewJob action
type ProcessedJob ¶
type ProcessedJob struct { UnprocessedJob WorkerName string StartTime time.Time FinishTime time.Time Successful bool ErrorMessage string }
ProcessedJob describes a completed job. Additional fields with respect to an unprocessed job are related to the execution time of the job and its completion status
type QueueClient ¶
type QueueClient struct { Conn *amqp.Connection Chan *amqp.Channel NewJobQueue *amqp.Queue CompletedJobQueue *amqp.Queue }
QueueClient containts all the objects associated with a connection to a RabbitMQ instance
func NewQueueClient ¶
func NewQueueClient(cfg *QueueConfig, connType int) (*QueueClient, error)
NewQueueClient creates a new connection to the queue. connType can either be consumerConnection or publisherConnection
type QueueConfig ¶
type QueueConfig struct { Username string Password string Host string VHost string Port int NewJobExchange string `mapstructure:"new_job_exchange"` NewJobQueue string `mapstructure:"new_job_queue"` CompletedJobExchange string `mapstructure:"completed_job_exchange"` }
QueueConfig - configuration of message queue (RabbitMQ)
type RequestCancelled ¶
type RequestCancelled struct{}
RequestCancelled is an error value that signals a cancelled HTTP request
func (RequestCancelled) Error ¶
func (c RequestCancelled) Error() string
type ServerConfig ¶
ServerConfig - configuration of the Conveyor jov server
type UnprocessedJob ¶
type UnprocessedJob struct { ID uuid.UUID JobSpecification }
UnprocessedJob describes a job which has been submitted, having been assigned a unique ID
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
Waiter implements an exponential backoff retry scheme: each successive call to Wait() will block for double the time of the previous call, up to a specified maximum time
func DefaultWaiter ¶
func DefaultWaiter() Waiter
DefaultWaiter constructs a Waiter object with the default wait values
func NewWaiter ¶
NewWaiter constructs a Waiter object with the specified initial and maximum wait values
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker encapsulates the loop where job descriptions received from the conveyor server are downloaded and processed
type WorkerConfig ¶
type WorkerConfig struct { Name string JobRetries int `mapstructure:"job_retries"` TempDir string `mapstructure:"temp_dir"` }
WorkerConfig - configuration of the Conveyor worker daemon