Documentation
¶
Overview ¶
Copyright © 2023 Jonathan Gotti <jgotti at jgotti dot org> SPDX-FileType: SOURCE SPDX-License-Identifier: MIT SPDX-FileCopyrightText: 2023 Jonathan Gotti <jgotti@jgotti.org>
Copyright © 2023 Jonathan Gotti <jgotti at jgotti dot org> SPDX-FileType: SOURCE SPDX-License-Identifier: MIT SPDX-FileCopyrightText: 2023 Jonathan Gotti <jgotti@jgotti.org>
Copyright © 2023 Jonathan Gotti <jgotti at jgotti dot org> SPDX-FileType: SOURCE SPDX-License-Identifier: MIT SPDX-FileCopyrightText: 2023 Jonathan Gotti <jgotti@jgotti.org>
Copyright © 2023 Jonathan Gotti <jgotti at jgotti dot org> SPDX-FileType: SOURCE SPDX-License-Identifier: MIT SPDX-FileCopyrightText: 2023 Jonathan Gotti <jgotti@jgotti.org>
Index ¶
- Constants
- func SetMaxConcurrentJobs(n int)
- func SetTemplateString(templateString string)
- type ExecuteOptions
- type JobError
- type JobExecutor
- func (e *JobExecutor) AddJobCmd(cmd string, args ...string) *JobExecutor
- func (e *JobExecutor) AddJobCmds(cmdsAndArgs ...[]string) *JobExecutor
- func (e *JobExecutor) AddJobFns(fns ...runnableFn) *JobExecutor
- func (e *JobExecutor) Execute() JobsError
- func (e *JobExecutor) Len() int
- func (e *JobExecutor) OnJobDone(fn jobEventHandler) *JobExecutor
- func (e *JobExecutor) OnJobStart(fn jobEventHandler) *JobExecutor
- func (e *JobExecutor) OnJobsDone(fn jobsEventHandler) *JobExecutor
- func (e *JobExecutor) OnJobsStart(fn jobsEventHandler) *JobExecutor
- func (e *JobExecutor) WithFifoOutput() *JobExecutor
- func (e *JobExecutor) WithOrderedOutput() *JobExecutor
- func (e *JobExecutor) WithProgressOutput() *JobExecutor
- func (e *JobExecutor) WithStartOutput() *JobExecutor
- func (e *JobExecutor) WithStartSummary() *JobExecutor
- type JobList
- type JobsError
Constants ¶
const ( JobStatePending = 0 JobStateRunning = 1 JobStateDone = 2 JobStateSucceed = 4 JobStateFailed = 8 )
Variables ¶
This section is empty.
Functions ¶
func SetMaxConcurrentJobs ¶
func SetMaxConcurrentJobs(n int)
set the default number of concurrent jobs to run default to GOMAXPROCS
func SetTemplateString ¶
func SetTemplateString(templateString string)
Template for all outputs related to jobs it must define the following templates: - startSummary: which will receive a JobList - jobStatus: which will receive a single job - progressReport: which will receive a jobList - doneReport: which will receive a jobList
Types ¶
type ExecuteOptions ¶
type ExecuteOptions struct {
// contains filtered or unexported fields
}
type JobError ¶
func NewJobError ¶
type JobExecutor ¶
type JobExecutor struct {
// contains filtered or unexported fields
}
func (*JobExecutor) AddJobCmd ¶
func (e *JobExecutor) AddJobCmd(cmd string, args ...string) *JobExecutor
func (*JobExecutor) AddJobCmds ¶
func (e *JobExecutor) AddJobCmds(cmdsAndArgs ...[]string) *JobExecutor
Add miltiple job command to execute
func (*JobExecutor) AddJobFns ¶
func (e *JobExecutor) AddJobFns(fns ...runnableFn) *JobExecutor
Add one or more job function to run (func() (string, error))
func (*JobExecutor) Execute ¶
func (e *JobExecutor) Execute() JobsError
effectively execute jobs and return collected errors as JobsError
func (*JobExecutor) Len ¶
func (e *JobExecutor) Len() int
return the total number of jobs in the pool
func (*JobExecutor) OnJobDone ¶
func (e *JobExecutor) OnJobDone(fn jobEventHandler) *JobExecutor
Add an handler which will be call after a jobs is terminated
func (*JobExecutor) OnJobStart ¶
func (e *JobExecutor) OnJobStart(fn jobEventHandler) *JobExecutor
Add an handler which will be call before a jobs is started
func (*JobExecutor) OnJobsDone ¶
func (e *JobExecutor) OnJobsDone(fn jobsEventHandler) *JobExecutor
Add an handler which will be call after all jobs are terminated
func (*JobExecutor) OnJobsStart ¶
func (e *JobExecutor) OnJobsStart(fn jobsEventHandler) *JobExecutor
Add an handler which will be call before any jobs is started
func (*JobExecutor) WithFifoOutput ¶
func (e *JobExecutor) WithFifoOutput() *JobExecutor
Display full jobStatus as they arrive
func (*JobExecutor) WithOrderedOutput ¶
func (e *JobExecutor) WithOrderedOutput() *JobExecutor
display doneReport when all jobs are Done
func (*JobExecutor) WithProgressOutput ¶
func (e *JobExecutor) WithProgressOutput() *JobExecutor
will override onJobStarts / onJobStart / onJobDone handlers previsously defined generally you should avoid using these method with other handlers bound to the JobExecutor instance
func (*JobExecutor) WithStartOutput ¶
func (e *JobExecutor) WithStartOutput() *JobExecutor
Output a line to say a job is starting
func (*JobExecutor) WithStartSummary ¶
func (e *JobExecutor) WithStartSummary() *JobExecutor
Output a summary of the job that will be run