Documentation ¶
Index ¶
- func NewManagementClient(url string) management.Manager
- func NewManagementClientFromExisting(client *http.Client, url string) management.Manager
- type AbortablePoolManagementClient
- func (c *AbortablePoolManagementClient) AbortAllJobs(ctx context.Context) error
- func (c *AbortablePoolManagementClient) AbortJob(ctx context.Context, job string) error
- func (c *AbortablePoolManagementClient) IsRunning(ctx context.Context, job string) (bool, error)
- func (c *AbortablePoolManagementClient) ListJobs(ctx context.Context) ([]string, error)
- type AbortablePoolManagementService
- func (s *AbortablePoolManagementService) AbortAllJobs(rw http.ResponseWriter, r *http.Request)
- func (s *AbortablePoolManagementService) AbortRunningJob(rw http.ResponseWriter, r *http.Request)
- func (s *AbortablePoolManagementService) App() *gimlet.APIApp
- func (s *AbortablePoolManagementService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
- func (s *AbortablePoolManagementService) ListJobs(rw http.ResponseWriter, r *http.Request)
- type ManagementGroupService
- func (s *ManagementGroupService) AbortAllJobs(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementGroupService) AbortRunningJob(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementGroupService) App() *gimlet.APIApp
- func (s *ManagementGroupService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementGroupService) ListJobs(rw http.ResponseWriter, r *http.Request)
- type ManagementService
- func (s *ManagementService) App() *gimlet.APIApp
- func (s *ManagementService) GetJobIDs(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementService) MarkComplete(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementService) MarkCompleteByPattern(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementService) MarkCompleteByType(rw http.ResponseWriter, r *http.Request)
- func (s *ManagementService) MarkManyComplete(rw http.ResponseWriter, r *http.Request)
- type QueueClient
- func (c *QueueClient) FetchJob(ctx context.Context, name string) (amboy.Job, error)
- func (c *QueueClient) Host() string
- func (c *QueueClient) JobComplete(ctx context.Context, name string) (bool, error)
- func (c *QueueClient) MarkJobComplete(ctx context.Context, id string) error
- func (c *QueueClient) PendingJobs(ctx context.Context) (int, error)
- func (c *QueueClient) Port() int
- func (c *QueueClient) Prefix() string
- func (c *QueueClient) Running(ctx context.Context) (bool, error)
- func (c *QueueClient) SetHost(h string) error
- func (c *QueueClient) SetPort(p int) error
- func (c *QueueClient) SetPrefix(p string) error
- func (c *QueueClient) SubmitJob(ctx context.Context, j amboy.Job) (string, error)
- func (c *QueueClient) Wait(ctx context.Context, name string) bool
- func (c *QueueClient) WaitAll(ctx context.Context) bool
- type QueueService
- func (s *QueueService) App() *gimlet.APIApp
- func (s *QueueService) Close()
- func (s *QueueService) Create(w http.ResponseWriter, r *http.Request)
- func (s *QueueService) Fetch(w http.ResponseWriter, r *http.Request)
- func (s *QueueService) JobStatus(w http.ResponseWriter, r *http.Request)
- func (s *QueueService) Open(ctx context.Context) error
- func (s *QueueService) OpenWithOptions(ctx context.Context, opts QueueServiceOptions) error
- func (s *QueueService) Queue() amboy.Queue
- func (s *QueueService) SetQueue(q amboy.Queue) error
- func (s *QueueService) Status(w http.ResponseWriter, r *http.Request)
- func (s *QueueService) WaitAll(w http.ResponseWriter, r *http.Request)
- func (s *QueueService) WaitJob(w http.ResponseWriter, r *http.Request)
- type QueueServiceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewManagementClient ¶
func NewManagementClient(url string) management.Manager
NewManagementClient constructs a management.Manager instance, with its own HTTP client. All calls
func NewManagementClientFromExisting ¶
func NewManagementClientFromExisting(client *http.Client, url string) management.Manager
NewManagementClientFromExisting constructs a new managementClient instance from an existing HTTP Client.
Types ¶
type AbortablePoolManagementClient ¶
type AbortablePoolManagementClient struct {
// contains filtered or unexported fields
}
AbortablePoolManagementClient provides a go wrapper to the AbortablePoolManagement service.
func NewAbortablePoolManagementClient ¶
func NewAbortablePoolManagementClient(url string) *AbortablePoolManagementClient
NewAbortablePoolManagementClient constructs a new AbortablePoolManagementClient instance that constructs a new http.Client.
func NewAbortablePoolManagementClientFromExisting ¶
func NewAbortablePoolManagementClientFromExisting(client *http.Client, url string) *AbortablePoolManagementClient
NewAbortablePoolManagementClientFromExisting builds an AbortablePoolManagementClient instance from an existing http.Client.
func (*AbortablePoolManagementClient) AbortAllJobs ¶
func (c *AbortablePoolManagementClient) AbortAllJobs(ctx context.Context) error
AbortAllJobs issues the request to terminate all currently running jobs managed by the pool that backs the request.
func (*AbortablePoolManagementClient) AbortJob ¶
func (c *AbortablePoolManagementClient) AbortJob(ctx context.Context, job string) error
AbortJob sends the abort signal for a running job to the management service, return any errors from the service. A nil response indicates that the job has been successfully terminated.
type AbortablePoolManagementService ¶
type AbortablePoolManagementService struct {
// contains filtered or unexported fields
}
AbortablePoolManagementService defines a set of rest routes that make it possible to remotely manage the jobs running in an abortable pool.
func NewAbortablePoolManagementService ¶
func NewAbortablePoolManagementService(p amboy.AbortableRunner) *AbortablePoolManagementService
NewAbortablePoolManagementService returns a service that defines REST routes can manage an abortable pool.
func (*AbortablePoolManagementService) AbortAllJobs ¶
func (s *AbortablePoolManagementService) AbortAllJobs(rw http.ResponseWriter, r *http.Request)
AbortAllJobs is an http.HandlerFunc that sends the signal to abort all running jobs in the pool. May return a 408 (timeout) if the calling context was canceled before the operation returned. Otherwise, this handler returns 200. The body of the response is always empty.
func (*AbortablePoolManagementService) AbortRunningJob ¶
func (s *AbortablePoolManagementService) AbortRunningJob(rw http.ResponseWriter, r *http.Request)
AbortRunningJob is an http.HandlerFunc that terminates the execution of a single running job, returning a 400 response when the job doesn't exist.
func (*AbortablePoolManagementService) App ¶
func (s *AbortablePoolManagementService) App() *gimlet.APIApp
App returns a gimlet app with all of the routes registered.
func (*AbortablePoolManagementService) GetJobStatus ¶
func (s *AbortablePoolManagementService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
GetJobStatus is an http.HandlerFunc reports on the status (running or not running) of a specific job.
func (*AbortablePoolManagementService) ListJobs ¶
func (s *AbortablePoolManagementService) ListJobs(rw http.ResponseWriter, r *http.Request)
ListJobs is an http.HandlerFunc that returns a list of all running jobs in the pool.
type ManagementGroupService ¶
type ManagementGroupService struct {
// contains filtered or unexported fields
}
ManagementGroupService provides the reporting service impelementation for queue groups.
func NewManagementGroupService ¶
func NewManagementGroupService(g amboy.QueueGroup) *ManagementGroupService
NewManagementGroupService returns a service that defines REST routes can manage the abortable pools of a QueueGroup.
func (*ManagementGroupService) AbortAllJobs ¶
func (s *ManagementGroupService) AbortAllJobs(rw http.ResponseWriter, r *http.Request)
AbortAllJobs is an http.HandlerFunc that sends the signal to abort all running jobs in the pools of the group. May return a 408 (timeout) if the calling context was canceled before the operation returned. Otherwise, this handler returns 200. The body of the response is always empty.
func (*ManagementGroupService) AbortRunningJob ¶
func (s *ManagementGroupService) AbortRunningJob(rw http.ResponseWriter, r *http.Request)
AbortRunningJob is an http.HandlerFunc that terminates the execution of a single running job, returning a 400 response when the job doesn't exist.
func (*ManagementGroupService) App ¶
func (s *ManagementGroupService) App() *gimlet.APIApp
App returns a gimlet app with all of the routes registered.
func (*ManagementGroupService) GetJobStatus ¶
func (s *ManagementGroupService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
GetJobStatus is an http.HandlerFunc reports on the status (running or not running) of a specific job.
func (*ManagementGroupService) ListJobs ¶
func (s *ManagementGroupService) ListJobs(rw http.ResponseWriter, r *http.Request)
ListJobs is an http.HandlerFunc that returns a list of all running jobs in all pools for the queue group.
type ManagementService ¶
type ManagementService struct {
// contains filtered or unexported fields
}
ManagementService wraps a manager instance as described in the management package and provides an HTTP interface for all of the methods provided by methods provided by the manager.
func NewManagementService ¶
func NewManagementService(m management.Manager) *ManagementService
NewManagementService constructs a management service from the manager provided.
func (*ManagementService) App ¶
func (s *ManagementService) App() *gimlet.APIApp
App returns a gimlet application with all of the routes configured.
func (*ManagementService) GetJobIDs ¶
func (s *ManagementService) GetJobIDs(rw http.ResponseWriter, r *http.Request)
GetJobIDs is an http.HandlerFunc that produces a list of job IDs for jobs that match a status filter and job type.
func (*ManagementService) GetJobStatus ¶
func (s *ManagementService) GetJobStatus(rw http.ResponseWriter, r *http.Request)
GetJobStatus is an http.HandlerFunc that counts all jobs that match a status filter.
func (*ManagementService) MarkComplete ¶
func (s *ManagementService) MarkComplete(rw http.ResponseWriter, r *http.Request)
MarkComplete is an http.Handlerfunc marks the given job complete.
func (*ManagementService) MarkCompleteByPattern ¶
func (s *ManagementService) MarkCompleteByPattern(rw http.ResponseWriter, r *http.Request)
MarkCompleteByPattern is an http.Handlerfunc marks all jobs with the specified pattern and status complete.
func (*ManagementService) MarkCompleteByType ¶
func (s *ManagementService) MarkCompleteByType(rw http.ResponseWriter, r *http.Request)
MarkCompleteByType is an http.Handlerfunc marks all jobs of the given type complete.
func (*ManagementService) MarkManyComplete ¶
func (s *ManagementService) MarkManyComplete(rw http.ResponseWriter, r *http.Request)
MarkManyComplete is an http.Handlerfunc marks all jobs of the specified status complete.
type QueueClient ¶
type QueueClient struct {
// contains filtered or unexported fields
}
QueueClient provides an interface for interacting with a remote amboy Service.
func NewQueueClient ¶
func NewQueueClient(host string, port int, prefix string) (*QueueClient, error)
NewQueueClient takes host, port, and URI prefix information and constructs a new QueueClient.
func NewQueueClientFromExisting ¶
func NewQueueClientFromExisting(client *http.Client, host string, port int, prefix string) (*QueueClient, error)
NewQueueClientFromExisting takes an existing http.Client object and produces a new QueueClient object.
func (*QueueClient) FetchJob ¶
FetchJob takes the name of a queue, and returns if possible a representation of that job object.
func (*QueueClient) JobComplete ¶
JobComplete checks the stats of a job, by name, and returns true if that job is complete. When false, check the second return value to ensure that the job exists in the remote queue.
func (*QueueClient) MarkJobComplete ¶
func (c *QueueClient) MarkJobComplete(ctx context.Context, id string) error
MarkJobComplete marks the job with the given ID complete.
func (*QueueClient) PendingJobs ¶
func (c *QueueClient) PendingJobs(ctx context.Context) (int, error)
PendingJobs reports on the total number of jobs currently dispatched by the queue to workers.
func (*QueueClient) Port ¶
func (c *QueueClient) Port() int
Port returns the current port value for the QueueClient.
func (*QueueClient) Prefix ¶
func (c *QueueClient) Prefix() string
Prefix accesses the prefix for the client, The prefix is the part of the URI between the end-point and the hostname, of the API.
func (*QueueClient) Running ¶
func (c *QueueClient) Running(ctx context.Context) (bool, error)
Running is true when the underlying queue is running and accepting jobs, and false when the queue is not runner or if there's a problem connecting to the queue.
func (*QueueClient) SetHost ¶
func (c *QueueClient) SetHost(h string) error
SetHost allows callers to change the hostname (including leading "http(s)") for the Client. Returns an error if the specified host does not start with "http".
func (*QueueClient) SetPort ¶
func (c *QueueClient) SetPort(p int) error
SetPort allows callers to change the port used for the client. If the port is invalid, returns an error and sets the port to the default value. (3000)
func (*QueueClient) SetPrefix ¶
func (c *QueueClient) SetPrefix(p string) error
SetPrefix allows callers to modify the prefix, for this client,
func (*QueueClient) SubmitJob ¶
SubmitJob adds a job to a remote queue connected to the rest interface.
type QueueService ¶
type QueueService struct {
// contains filtered or unexported fields
}
QueueService is used as a place holder for application state and configuration.
func NewQueueService ¶
func NewQueueService() *QueueService
NewQueueService constructs a new service object. Use the Open() method to initialize the service. The Open and OpenWithOptions methods configure an embedded amboy service. If you use SetQueue you do not need to call an open method.
Use the App() method to get a gimlet Application that you can use to run the service.
func (*QueueService) App ¶
func (s *QueueService) App() *gimlet.APIApp
App provides access to the gimplet.APIApp instance which builds and orchestrates the REST API. Use this method if you want to combine the routes in this QueueService with another service, or add additional routes to support other application functionality.
func (*QueueService) Close ¶
func (s *QueueService) Close()
Close releases resources (i.e. the queue) associated with the service. If you've used SetQueue to define the embedded queue, rather than Open/OpenWithOptions,
func (*QueueService) Create ¶
func (s *QueueService) Create(w http.ResponseWriter, r *http.Request)
Create provides an interface for REST clients to create jobs in the local queue that backs the service.
func (*QueueService) Fetch ¶
func (s *QueueService) Fetch(w http.ResponseWriter, r *http.Request)
Fetch is an http handler that writes a job interchange object to a the response, and allows clients to retrieve jobs from the service.
func (*QueueService) JobStatus ¶
func (s *QueueService) JobStatus(w http.ResponseWriter, r *http.Request)
JobStatus is a http.HandlerFunc that writes a job status document to the request.
func (*QueueService) Open ¶
func (s *QueueService) Open(ctx context.Context) error
Open populates the application and starts the underlying queue. This method sets and initializes a LocalLimitedSize queue implementation, with 2 workers and storage for 256 jobs. Use OpenInfo to have more control over the embedded queue. Use the Close() method on the service to terminate the queue.
func (*QueueService) OpenWithOptions ¶
func (s *QueueService) OpenWithOptions(ctx context.Context, opts QueueServiceOptions) error
OpenWithOptions makes it possible to configure the underlying queue in a service. Use the Close() method on the service to terminate the queue.
func (*QueueService) Queue ¶
func (s *QueueService) Queue() amboy.Queue
Queue provides access to the underlying queue object for the service.
func (*QueueService) SetQueue ¶
func (s *QueueService) SetQueue(q amboy.Queue) error
SetQueue allows callers to inject an alternate queue implementation.
func (*QueueService) Status ¶
func (s *QueueService) Status(w http.ResponseWriter, r *http.Request)
Status defines an http.HandlerFunc that returns health check and current staus status information for the entire service.
func (*QueueService) WaitAll ¶
func (s *QueueService) WaitAll(w http.ResponseWriter, r *http.Request)
WaitAll blocks waiting for all pending jobs in the queue to stop. Has a default timeout of 10 seconds, and returns 408 (request timeout) when the timeout succeeds.
func (*QueueService) WaitJob ¶
func (s *QueueService) WaitJob(w http.ResponseWriter, r *http.Request)
WaitJob waits for a single job to be complete. It takes a timeout argument, which defaults to 10 seconds, and returns 408 (request timeout) if the timeout is reached before the job completes.
type QueueServiceOptions ¶
type QueueServiceOptions struct { // ForceTimeout makes it possible to control how long to wait // for pending jobs to complete before canceling existing // work. If this value is zeroed, the Open operation will // close the previous queue and start a new queue, otherwise // it will attempt to wait for the specified time before closing // the previous queue. ForceTimeout time.Duration `bson:"force_timeout,omitempty" json:"force_timeout,omitempty" yaml:"force_timeout,omitempty"` // The default queue constructed by Open/OpenWith retains a // limited number of completed jobs to avoid unbounded memory // growth. This value *must* be specified. QueueSize int `bson:"queue_size" json:"queue_size" yaml:"queue_size"` // Controls the maximum number of go routines that can service // jobs in a queue. NumWorkers int `bson:"num_workers" json:"num_workers" yaml:"num_workers"` }
QueueServiceOptions provides a way to configure resources allocated by a service.