Documentation ¶
Index ¶
- Constants
- Variables
- type CleanupProvider
- type CleanupTask
- type JobDetails
- type MultiJobRequest
- type SqliteProvider
- func (p *SqliteProvider) CleanupJobsMultiJobs(ctx context.Context, maxJobs int) error
- func (p *SqliteProvider) Close() error
- func (p *SqliteProvider) Count(ctx context.Context, options *query.ListOptions) (int, error)
- func (p *SqliteProvider) CountMultiJobs(ctx context.Context, options *query.ListOptions) (int, error)
- func (p *SqliteProvider) CreateJob(job *models.Job) error
- func (p *SqliteProvider) GetByJID(clientID, jid string) (*models.Job, error)
- func (p *SqliteProvider) GetDB() (db *sqlx.DB)
- func (p *SqliteProvider) GetMultiJob(ctx context.Context, jid string) (*models.MultiJob, error)
- func (p *SqliteProvider) GetMultiJobSummaries(ctx context.Context, options *query.ListOptions) ([]*models.MultiJobSummary, error)
- func (p *SqliteProvider) List(ctx context.Context, options *query.ListOptions) ([]*models.Job, error)
- func (p *SqliteProvider) SaveJob(job *models.Job) error
- func (p *SqliteProvider) SaveMultiJob(job *models.MultiJob) error
Constants ¶
View Source
const ( DefaultLimit = 100 MaxLimit = 1000 )
Variables ¶
View Source
var JobListDefaultFields = map[string][]string{
"fields[jobs]": {
"jid",
"status",
"finished_at",
},
"fields[result]": {
"summary",
},
}
View Source
var JobSupportedFields = map[string]map[string]bool{ "jobs": jobFields, "commands": jobFields, "scripts": jobFields, "result": { "stdout": true, "stderr": true, "summary": true, }, }
View Source
var JobSupportedFilters = map[string]bool{ "jid": true, "started_at[gt]": true, "started_at[lt]": true, "started_at[since]": true, "started_at[until]": true, "finished_at[gt]": true, "finished_at[lt]": true, "finished_at[since]": true, "finished_at[until]": true, "status": true, "created_by": true, "multi_job_id": true, "schedule_id": true, "client_id": true, }
View Source
var JobSupportedSorts = map[string]bool{ "jid": true, "started_at": true, "finished_at": true, "status": true, "multi_job_id": true, "schedule_id": true, "created_by": true, }
Functions ¶
This section is empty.
Types ¶
type CleanupProvider ¶
type CleanupTask ¶
type CleanupTask struct {
// contains filtered or unexported fields
}
func NewCleanupTask ¶
func NewCleanupTask(provider CleanupProvider, maxJobs int) *CleanupTask
type JobDetails ¶
type JobDetails struct { Command string `json:"command"` Cwd string `json:"cwd"` IsSudo bool `json:"is_sudo"` IsScript bool `json:"is_script"` Interpreter string `json:"interpreter"` PID *int `json:"pid"` TimeoutSec int `json:"timeout_sec"` Error string `json:"error"` Result *models.JobResult `json:"result"` ClientName string `json:"client_name"` }
func (*JobDetails) Scan ¶
func (d *JobDetails) Scan(value interface{}) error
type MultiJobRequest ¶
type MultiJobRequest struct { ClientIDs []string `json:"client_ids"` GroupIDs []string `json:"group_ids"` ClientTags *models.JobClientTags `json:"tags"` Command string `json:"command"` Script string `json:"script"` Cwd string `json:"cwd"` IsSudo bool `json:"is_sudo"` Interpreter string `json:"interpreter"` TimeoutSec int `json:"timeout_sec"` ExecuteConcurrently bool `json:"execute_concurrently"` AbortOnError *bool `json:"abort_on_error"` // pointer is used because it's default value is true. Otherwise it would be more difficult to check whether this field is missing or not Username string `json:"-"` IsScript bool `json:"-"` OrderedClients []*clientdata.Client `json:"-"` ScheduleID *string `json:"-"` }
func (*MultiJobRequest) GetClientIDs ¶
func (req *MultiJobRequest) GetClientIDs() (ids []string)
func (*MultiJobRequest) GetClientTags ¶
func (req *MultiJobRequest) GetClientTags() (clientTags *models.JobClientTags)
func (*MultiJobRequest) GetGroupIDs ¶
func (req *MultiJobRequest) GetGroupIDs() (ids []string)
type SqliteProvider ¶
type SqliteProvider struct {
// contains filtered or unexported fields
}
func NewSqliteProvider ¶
func NewSqliteProvider(db *sqlx.DB, log *logger.Logger) *SqliteProvider
func (*SqliteProvider) CleanupJobsMultiJobs ¶
func (p *SqliteProvider) CleanupJobsMultiJobs(ctx context.Context, maxJobs int) error
func (*SqliteProvider) Close ¶
func (p *SqliteProvider) Close() error
func (*SqliteProvider) Count ¶
func (p *SqliteProvider) Count(ctx context.Context, options *query.ListOptions) (int, error)
func (*SqliteProvider) CountMultiJobs ¶
func (p *SqliteProvider) CountMultiJobs(ctx context.Context, options *query.ListOptions) (int, error)
CountMultiJobs counts multi-clients jobs filtered by options
func (*SqliteProvider) CreateJob ¶
func (p *SqliteProvider) CreateJob(job *models.Job) error
CreateJob creates a new job. If already exists with the same ID - does nothing and returns nil.
func (*SqliteProvider) GetByJID ¶
func (p *SqliteProvider) GetByJID(clientID, jid string) (*models.Job, error)
func (*SqliteProvider) GetDB ¶
func (p *SqliteProvider) GetDB() (db *sqlx.DB)
TODO: this was added to support test dependencies. we could potentially remove if there's a better way.
func (*SqliteProvider) GetMultiJob ¶
GetMultiJob returns a multi-client job with fetched all clients' jobs.
func (*SqliteProvider) GetMultiJobSummaries ¶
func (p *SqliteProvider) GetMultiJobSummaries(ctx context.Context, options *query.ListOptions) ([]*models.MultiJobSummary, error)
GetMultiJobSummaries returns a list of summaries of multi-clients jobs filtered by options and sorted by started_at(desc), jid order.
func (*SqliteProvider) List ¶
func (p *SqliteProvider) List(ctx context.Context, options *query.ListOptions) ([]*models.Job, error)
func (*SqliteProvider) SaveJob ¶
func (p *SqliteProvider) SaveJob(job *models.Job) error
SaveJob creates a new or updates an existing job.
func (*SqliteProvider) SaveMultiJob ¶
func (p *SqliteProvider) SaveMultiJob(job *models.MultiJob) error
SaveMultiJob creates a new or updates an existing multi-client job (without child jobs).
Click to show internal directories.
Click to hide internal directories.