Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UniqueString ¶
func UniqueString() string
UniqueString returns a unique string that could be useful for supplying as depGroup values to NewJob() etc. The length is always 20 characters.
Types ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler can be used to schedule commands to be executed by adding them to wr's queue.
func New ¶
func New(deployment, cwd string, timeout time.Duration, logger log15.Logger, sudo bool) (*Scheduler, error)
New returns a Scheduler that is connected to wr manager using the given deployment, timeout and logger. If sudo is true, NewJob() will prefix 'sudo' to commands. Added jobs will have the given cwd, which matters. If cwd is blank, the current working dir is used.
func (*Scheduler) Disconnect ¶
Disconnect disconnects from the manager. You should defer this after New().
func (*Scheduler) Executable ¶
Executable is a convenience function that returns the same as os.Executable(), but without the error.
func (*Scheduler) NewJob ¶
NewJob is a convenience function for creating Jobs. It sets the job's Cwd to the current working directory, sets CwdMatters to true, applies a minimal Requirements, and sets Retries to 3.
If this Scheduler had been made with sudo: true, cmd will be prefixed with 'sudo '.
THe supplied depGroup and dep can be blank to not set DepGroups and Dependencies.
func (*Scheduler) SubmitJobs ¶
SubmitJobs adds the given jobs to wr's queue, passing through current environment variables.
Previously added identical jobs that have since been archived will get added again.
If any duplicate jobs were added, an error will be returned.