persistence

package
v0.0.0-...-dfed899 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package persistence provides the database interface for Flamenco Manager.

SPDX-License-Identifier: GPL-3.0-or-later

SPDX-License-Identifier: GPL-3.0-or-later

SPDX-License-Identifier: GPL-3.0-or-later

Package persistence provides the database interface for Flamenco Manager.

Index

Constants

View Source
const TestDSN = "file::memory:"

Change this to a filename if you want to run a single test and inspect the resulting database.

Variables

View Source
var (
	ErrJobNotFound       = PersistenceError{Message: "job not found", Err: sql.ErrNoRows}
	ErrTaskNotFound      = PersistenceError{Message: "task not found", Err: sql.ErrNoRows}
	ErrWorkerNotFound    = PersistenceError{Message: "worker not found", Err: sql.ErrNoRows}
	ErrWorkerTagNotFound = PersistenceError{Message: "worker tag not found", Err: sql.ErrNoRows}

	ErrDeletingWithoutFK = errors.New("refusing to delete a job when foreign keys are not enabled on the database")

	// ErrContextCancelled wraps the SQLite error "interrupted (9)". That error is
	// (as far as Sybren could figure out) caused by the context being closed.
	// Unfortunately there is no wrapping of the context error, so it's not
	// possible to determine whether it was due to a 'deadline exceeded' error or
	// another cancellation cause (like upstream HTTP connection closing).
	ErrContextCancelled = errors.New("context cancelled")
)
View Source
var ErrIntegrity = errors.New("database integrity check failed")

Functions

func ErrIsDBBusy

func ErrIsDBBusy(err error) bool

ErrIsDBBusy returns true when the error is a "database busy" error.

Types

type Command

type Command struct {
	Name       string             `json:"name"`
	Parameters StringInterfaceMap `json:"parameters"`
}

type Commands

type Commands []Command

func (*Commands) Scan

func (c *Commands) Scan(value interface{}) error

func (Commands) Value

func (c Commands) Value() (driver.Value, error)

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB provides the database interface.

func CreateTestDB

func CreateTestDB() (db *DB, closer func())

func OpenDB

func OpenDB(ctx context.Context, dsn string) (*DB, error)

func (*DB) AddWorkerToJobBlocklist

func (db *DB) AddWorkerToJobBlocklist(ctx context.Context, job *Job, worker *Worker, taskType string) error

AddWorkerToJobBlocklist prevents this Worker of getting any task, of this type, on this job, from the task scheduler.

func (*DB) AddWorkerToTaskFailedList

func (db *DB) AddWorkerToTaskFailedList(ctx context.Context, t *Task, w *Worker) (numFailed int, err error)

AddWorkerToTaskFailedList records that the given worker failed the given task. This information is not used directly by the task scheduler. It's used to determine whether there are any workers left to perform this task, and thus whether it should be hard- or soft-failed.

Calling this multiple times with the same task/worker is a no-op.

Returns the new number of workers that failed this task.

func (*DB) ClearFailureListOfJob

func (db *DB) ClearFailureListOfJob(ctx context.Context, j *Job) error

ClearFailureListOfJob en-mass, for all tasks of this job, clears the list of workers that failed those tasks.

func (*DB) ClearFailureListOfTask

func (db *DB) ClearFailureListOfTask(ctx context.Context, t *Task) error

ClearFailureListOfTask clears the list of workers that failed this task.

func (*DB) ClearJobBlocklist

func (db *DB) ClearJobBlocklist(ctx context.Context, job *Job) error

ClearJobBlocklist removes the entire blocklist of this job.

func (*DB) Close

func (db *DB) Close() error

Close closes the connection to the database.

func (*DB) CountTaskFailuresOfWorker

func (db *DB) CountTaskFailuresOfWorker(ctx context.Context, job *Job, worker *Worker, taskType string) (int, error)

CountTaskFailuresOfWorker returns the number of task failures of this worker, on this particular job and task type.

func (*DB) CountTasksOfJobInStatus

func (db *DB) CountTasksOfJobInStatus(
	ctx context.Context,
	job *Job,
	taskStatuses ...api.TaskStatus,
) (numInStatus, numTotal int, err error)

CountTasksOfJobInStatus counts the number of tasks in the job. It returns two counts, one is the number of tasks in the given statuses, the other is the total number of tasks of the job.

func (*DB) CreateWorker

func (db *DB) CreateWorker(ctx context.Context, w *Worker) error

func (*DB) CreateWorkerTag

func (db *DB) CreateWorkerTag(ctx context.Context, wc *WorkerTag) error

func (*DB) DeleteJob

func (db *DB) DeleteJob(ctx context.Context, jobUUID string) error

DeleteJob deletes a job from the database. The deletion cascades to its tasks and other job-related tables.

func (*DB) DeleteWorker

func (db *DB) DeleteWorker(ctx context.Context, uuid string) error

func (*DB) DeleteWorkerTag

func (db *DB) DeleteWorkerTag(ctx context.Context, uuid string) error

DeleteWorkerTag deletes the given tag, after unassigning all workers from it.

func (*DB) FetchJob

func (db *DB) FetchJob(ctx context.Context, jobUUID string) (*Job, error)

FetchJob fetches a single job, without fetching its tasks.

func (*DB) FetchJobBlocklist

func (db *DB) FetchJobBlocklist(ctx context.Context, jobUUID string) ([]JobBlock, error)

FetchJobBlocklist fetches the blocklist for the given job. Workers are fetched too, and embedded in the returned list.

func (*DB) FetchJobShamanCheckoutID

func (db *DB) FetchJobShamanCheckoutID(ctx context.Context, jobUUID string) (string, error)

FetchJobShamanCheckoutID fetches the job's Shaman Checkout ID.

func (*DB) FetchJobs

func (db *DB) FetchJobs(ctx context.Context) ([]*Job, error)

func (*DB) FetchJobsDeletionRequested

func (db *DB) FetchJobsDeletionRequested(ctx context.Context) ([]string, error)

func (*DB) FetchJobsInStatus

func (db *DB) FetchJobsInStatus(ctx context.Context, jobStatuses ...api.JobStatus) ([]*Job, error)

func (*DB) FetchSleepScheduleWorker

func (db *DB) FetchSleepScheduleWorker(ctx context.Context, schedule *SleepSchedule) error

FetchSleepScheduleWorker sets the given schedule's `Worker` pointer.

func (*DB) FetchSleepSchedulesToCheck

func (db *DB) FetchSleepSchedulesToCheck(ctx context.Context) ([]*SleepSchedule, error)

FetchSleepSchedulesToCheck returns the sleep schedules that are due for a check.

func (*DB) FetchTask

func (db *DB) FetchTask(ctx context.Context, taskUUID string) (*Task, error)

func (*DB) FetchTaskFailureList

func (db *DB) FetchTaskFailureList(ctx context.Context, t *Task) ([]*Worker, error)

func (*DB) FetchTaskJobUUID

func (db *DB) FetchTaskJobUUID(ctx context.Context, taskUUID string) (string, error)

FetchTaskJobUUID fetches the job UUID of the given task.

func (*DB) FetchTasksOfJob

func (db *DB) FetchTasksOfJob(ctx context.Context, job *Job) ([]*Task, error)

FetchTaskIDsOfJob returns all tasks of the given job.

func (*DB) FetchTasksOfJobInStatus

func (db *DB) FetchTasksOfJobInStatus(ctx context.Context, job *Job, taskStatuses ...api.TaskStatus) ([]*Task, error)

FetchTasksOfJobInStatus returns those tasks of the given job that have any of the given statuses.

func (*DB) FetchTasksOfWorkerInStatus

func (db *DB) FetchTasksOfWorkerInStatus(ctx context.Context, worker *Worker, taskStatus api.TaskStatus) ([]*Task, error)

func (*DB) FetchTasksOfWorkerInStatusOfJob

func (db *DB) FetchTasksOfWorkerInStatusOfJob(ctx context.Context, worker *Worker, taskStatus api.TaskStatus, job *Job) ([]*Task, error)

func (*DB) FetchTimedOutTasks

func (db *DB) FetchTimedOutTasks(ctx context.Context, untouchedSince time.Time) ([]*Task, error)

FetchTimedOutTasks returns a slice of tasks that have timed out.

In order to time out, a task must be in status `active` and not touched by a Worker since `untouchedSince`.

The returned tasks also have their `Job` and `Worker` fields set.

func (*DB) FetchTimedOutWorkers

func (db *DB) FetchTimedOutWorkers(ctx context.Context, lastSeenBefore time.Time) ([]*Worker, error)

func (*DB) FetchWorker

func (db *DB) FetchWorker(ctx context.Context, uuid string) (*Worker, error)

func (*DB) FetchWorkerSleepSchedule

func (db *DB) FetchWorkerSleepSchedule(ctx context.Context, workerUUID string) (*SleepSchedule, error)

FetchWorkerSleepSchedule fetches the worker's sleep schedule. It does not fetch the worker itself. If you need that, call `FetchSleepScheduleWorker()` afterwards.

func (*DB) FetchWorkerTag

func (db *DB) FetchWorkerTag(ctx context.Context, uuid string) (*WorkerTag, error)

func (*DB) FetchWorkerTags

func (db *DB) FetchWorkerTags(ctx context.Context) ([]*WorkerTag, error)

func (*DB) FetchWorkerTask

func (db *DB) FetchWorkerTask(ctx context.Context, worker *Worker) (*Task, error)

FetchWorkerTask returns the most recent task assigned to the given Worker.

func (*DB) FetchWorkers

func (db *DB) FetchWorkers(ctx context.Context) ([]*Worker, error)

func (*DB) GetLastRenderedJobUUID

func (db *DB) GetLastRenderedJobUUID(ctx context.Context) (string, error)

GetLastRendered returns the UUID of the job with the most recent rendered image.

func (*DB) HasWorkerTags

func (db *DB) HasWorkerTags(ctx context.Context) (bool, error)

HasWorkerTags returns whether there are any tags defined at all.

func (*DB) JobHasTasksInStatus

func (db *DB) JobHasTasksInStatus(ctx context.Context, job *Job, taskStatus api.TaskStatus) (bool, error)

func (*DB) PeriodicIntegrityCheck

func (db *DB) PeriodicIntegrityCheck(
	ctx context.Context,
	period time.Duration,
	onErrorCallback func(),
)

PeriodicIntegrityCheck periodically checks the database integrity. This function only returns when the context is done.

func (*DB) QueryJobTaskSummaries

func (db *DB) QueryJobTaskSummaries(ctx context.Context, jobUUID string) ([]*Task, error)

QueryJobTaskSummaries retrieves all tasks of the job, but not all fields of those tasks. Fields are synchronised with api.TaskSummary.

func (*DB) RemoveFromJobBlocklist

func (db *DB) RemoveFromJobBlocklist(ctx context.Context, jobUUID, workerUUID, taskType string) error

func (*DB) RequestIntegrityCheck

func (db *DB) RequestIntegrityCheck()

RequestIntegrityCheck triggers a check of the database persistency.

func (*DB) RequestJobDeletion

func (db *DB) RequestJobDeletion(ctx context.Context, j *Job) error

RequestJobDeletion sets the job's "DeletionRequestedAt" field to "now".

func (*DB) RequestJobMassDeletion

func (db *DB) RequestJobMassDeletion(ctx context.Context, lastUpdatedMax time.Time) ([]string, error)

RequestJobMassDeletion sets multiple job's "DeletionRequestedAt" field to "now". The list of affected job UUIDs is returned.

func (*DB) SaveJobPriority

func (db *DB) SaveJobPriority(ctx context.Context, j *Job) error

SaveJobPriority saves the job's Priority field.

func (*DB) SaveJobStatus

func (db *DB) SaveJobStatus(ctx context.Context, j *Job) error

SaveJobStatus saves the job's Status and Activity fields.

func (*DB) SaveJobStorageInfo

func (db *DB) SaveJobStorageInfo(ctx context.Context, j *Job) error

SaveJobStorageInfo saves the job's Storage field. NOTE: this function does NOT update the job's `UpdatedAt` field. This is necessary for `cmd/shaman-checkout-id-setter` to do its work quietly.

func (*DB) SaveTask

func (db *DB) SaveTask(ctx context.Context, t *Task) error

SaveTask updates a task that already exists in the database. This function is not used by the Flamenco API, only by unit tests.

func (*DB) SaveTaskActivity

func (db *DB) SaveTaskActivity(ctx context.Context, t *Task) error

func (*DB) SaveTaskStatus

func (db *DB) SaveTaskStatus(ctx context.Context, t *Task) error

func (*DB) SaveWorker

func (db *DB) SaveWorker(ctx context.Context, w *Worker) error

func (*DB) SaveWorkerStatus

func (db *DB) SaveWorkerStatus(ctx context.Context, w *Worker) error

func (*DB) SaveWorkerTag

func (db *DB) SaveWorkerTag(ctx context.Context, tag *WorkerTag) error

func (*DB) ScheduleTask

func (db *DB) ScheduleTask(ctx context.Context, w *Worker) (*Task, error)

ScheduleTask finds a task to execute by the given worker. If no task is available, (nil, nil) is returned, as this is not an error situation. NOTE: this does not also fetch returnedTask.Worker, but returnedTask.WorkerID is set.

func (*DB) SetLastRendered

func (db *DB) SetLastRendered(ctx context.Context, j *Job) error

SetLastRendered sets this job as the one with the most recent rendered image.

func (*DB) SetWorkerSleepSchedule

func (db *DB) SetWorkerSleepSchedule(ctx context.Context, workerUUID string, schedule *SleepSchedule) error

func (*DB) SetWorkerSleepScheduleNextCheck

func (db *DB) SetWorkerSleepScheduleNextCheck(ctx context.Context, schedule *SleepSchedule) error

func (*DB) StoreAuthoredJob

func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.AuthoredJob) error

StoreJob stores an AuthoredJob and its tasks, and saves it to the database. The job will be in 'under construction' status. It is up to the caller to transition it to its desired initial status.

func (*DB) StoreAuthoredJobTaks

func (db *DB) StoreAuthoredJobTaks(
	ctx context.Context,
	job *Job,
	authoredJob *job_compilers.AuthoredJob,
) error

StoreAuthoredJobTaks is a low-level function that is only used for recreating an existing job's tasks. It stores `authoredJob`'s tasks, but attaches them to the already-persisted `job`.

func (*DB) SummarizeJobStatuses

func (db *DB) SummarizeJobStatuses(ctx context.Context) (JobStatusCount, error)

func (*DB) SummarizeWorkerStatuses

func (db *DB) SummarizeWorkerStatuses(ctx context.Context) (WorkerStatusCount, error)

func (*DB) TaskAssignToWorker

func (db *DB) TaskAssignToWorker(ctx context.Context, t *Task, w *Worker) error

TaskAssignToWorker assigns the given task to the given worker. This function is only used by unit tests. During normal operation, Flamenco uses the code in task_scheduler.go to assign tasks to workers.

func (*DB) TaskTouchedByWorker

func (db *DB) TaskTouchedByWorker(ctx context.Context, t *Task) error

TaskTouchedByWorker marks the task as 'touched' by a worker. This is used for timeout detection.

func (*DB) UpdateJobsTaskStatuses

func (db *DB) UpdateJobsTaskStatuses(ctx context.Context, job *Job,
	taskStatus api.TaskStatus, activity string) error

UpdateJobsTaskStatuses updates the status & activity of all tasks of `job`.

func (*DB) UpdateJobsTaskStatusesConditional

func (db *DB) UpdateJobsTaskStatusesConditional(ctx context.Context, job *Job,
	statusesToUpdate []api.TaskStatus, taskStatus api.TaskStatus, activity string) error

UpdateJobsTaskStatusesConditional updates the status & activity of the tasks of `job`, limited to those tasks with status in `statusesToUpdate`.

func (*DB) WorkerSeen

func (db *DB) WorkerSeen(ctx context.Context, w *Worker) error

WorkerSeen marks the worker as 'seen' by this Manager. This is used for timeout detection.

func (*DB) WorkerSetTags

func (db *DB) WorkerSetTags(ctx context.Context, worker *Worker, tagUUIDs []string) error

func (*DB) WorkersLeftToRun

func (db *DB) WorkersLeftToRun(ctx context.Context, job *Job, taskType string) (map[string]bool, error)

WorkersLeftToRun returns a set of worker UUIDs that can run tasks of the given type on the given job.

NOTE: this does NOT consider the task failure list, which blocks individual workers from individual tasks. This is ONLY concerning the job blocklist.

type GooseLogger

type GooseLogger struct{}

func (*GooseLogger) Fatalf

func (gl *GooseLogger) Fatalf(format string, v ...interface{})

func (*GooseLogger) Printf

func (gl *GooseLogger) Printf(format string, v ...interface{})

type Job

type Job struct {
	Model
	UUID string

	Name     string
	JobType  string
	Priority int
	Status   api.JobStatus
	Activity string

	Settings StringInterfaceMap
	Metadata StringStringMap

	DeleteRequestedAt sql.NullTime

	Storage JobStorageInfo

	WorkerTagID *uint
	WorkerTag   *WorkerTag
}

func (*Job) DeleteRequested

func (j *Job) DeleteRequested() bool

DeleteRequested returns whether deletion of this job was requested.

type JobBlock

type JobBlock struct {
	// Don't include the standard Gorm UpdatedAt or DeletedAt fields, as they're useless here.
	// Entries will never be updated, and should never be soft-deleted but just purged from existence.
	ID        uint
	CreatedAt time.Time

	JobID uint
	Job   *Job

	WorkerID uint
	Worker   *Worker

	TaskType string
}

JobBlock keeps track of which Worker is not allowed to run which task type on which job.

type JobStatusCount

type JobStatusCount map[api.JobStatus]int

JobStatusCount is a mapping from job status to the number of jobs in that status.

type JobStorageInfo

type JobStorageInfo struct {
	// ShamanCheckoutID is only set when the job was actually using Shaman storage.
	ShamanCheckoutID string
}

JobStorageInfo contains info about where the job files are stored. It is intended to be used when removing a job, which may include the removal of its files.

type LastRendered

type LastRendered struct {
	Model
	JobID uint
	Job   *Job
}

LastRendered only has one entry in its database table, to indicate the job that was the last to receive a "last rendered image" from a Worker. This is used to show the global last-rendered image in the web interface.

type LoggingDBConn

type LoggingDBConn struct {
	// contains filtered or unexported fields
}

LoggingDBConn wraps a database/sql.DB connection, so that it can be used with sqlc and log all the queries.

func (*LoggingDBConn) ExecContext

func (ldbc *LoggingDBConn) ExecContext(ctx context.Context, sql string, args ...interface{}) (sql.Result, error)

func (*LoggingDBConn) PrepareContext

func (ldbc *LoggingDBConn) PrepareContext(ctx context.Context, sql string) (*sql.Stmt, error)

func (*LoggingDBConn) QueryContext

func (ldbc *LoggingDBConn) QueryContext(ctx context.Context, sql string, args ...interface{}) (*sql.Rows, error)

func (*LoggingDBConn) QueryRowContext

func (ldbc *LoggingDBConn) QueryRowContext(ctx context.Context, sql string, args ...interface{}) *sql.Row

type Model

type Model struct {
	ID        uint
	CreatedAt time.Time
	UpdatedAt time.Time
}

Model contains the common database fields for most model structs. It is a copy of the gorm.Model struct, but without the `DeletedAt` field. Soft deletion is not used by Flamenco. If it ever becomes necessary to support soft-deletion, see https://gorm.io/docs/delete.html#Soft-Delete

type PersistenceError

type PersistenceError struct {
	Message string // The error message.
	Err     error  // Any wrapped error.
}

func (PersistenceError) Error

func (e PersistenceError) Error() string

func (PersistenceError) Is

func (e PersistenceError) Is(err error) bool

type SleepSchedule

type SleepSchedule struct {
	Model

	WorkerID uint
	Worker   *Worker

	IsActive bool

	// Space-separated two-letter strings indicating days of week the schedule is
	// active ("mo", "tu", etc.). Empty means "every day".
	DaysOfWeek string
	StartTime  TimeOfDay
	EndTime    TimeOfDay

	NextCheck time.Time
}

SleepSchedule belongs to a Worker, and determines when it's automatically sent to the 'asleep' and 'awake' states.

type StringInterfaceMap

type StringInterfaceMap map[string]interface{}

func (*StringInterfaceMap) Scan

func (js *StringInterfaceMap) Scan(value interface{}) error

func (StringInterfaceMap) Value

func (js StringInterfaceMap) Value() (driver.Value, error)

type StringStringMap

type StringStringMap map[string]string

func (*StringStringMap) Scan

func (js *StringStringMap) Scan(value interface{}) error

func (StringStringMap) Value

func (js StringStringMap) Value() (driver.Value, error)

type Task

type Task struct {
	Model
	UUID string

	Name       string
	Type       string
	JobID      uint
	Job        *Job
	JobUUID    string // Fetched by SQLC, handled by GORM in Task.AfterFind()
	IndexInJob int
	Priority   int
	Status     api.TaskStatus

	// Which worker is/was working on this.
	WorkerID      *uint
	Worker        *Worker
	WorkerUUID    string    // Fetched by SQLC, handled by GORM in Task.AfterFind()
	LastTouchedAt time.Time // Should contain UTC timestamps.

	// Dependencies are tasks that need to be completed before this one can run.
	Dependencies []*Task

	Commands Commands
	Activity string
}

type TaskFailure

type TaskFailure struct {
	// Don't include the standard Gorm ID, UpdatedAt, or DeletedAt fields, as they're useless here.
	// Entries will never be updated, and should never be soft-deleted but just purged from existence.
	CreatedAt time.Time
	TaskID    uint
	Task      *Task
	WorkerID  uint
	Worker    *Worker
}

TaskFailure keeps track of which Worker failed which Task.

type TimeOfDay

type TimeOfDay struct {
	Hour   int
	Minute int
}

TimeOfDay represents a time of day, and can be converted to/from a string. Its date and timezone components are ignored, and the time is supposed to be interpreted as local time on any date (f.e. a scheduled sleep time of some Worker on a certain day-of-week & local timezone).

TimeOfDay structs can also represent "no value", which will be marshaled as an empty string.

func EmptyTimeOfDay

func EmptyTimeOfDay() TimeOfDay

EmptyTimeOfDay returns a TimeOfDay struct with no value. See `TimeOfDay.HasValue()`.

func MakeTimeOfDay

func MakeTimeOfDay(someTime time.Time) TimeOfDay

MakeTimeOfDay converts a time.Time into a TimeOfDay.

func (TimeOfDay) Equals

func (ot TimeOfDay) Equals(other TimeOfDay) bool

Equals returns True iff both times represent the same time of day.

func (TimeOfDay) HasValue

func (ot TimeOfDay) HasValue() bool

func (TimeOfDay) IsAfter

func (ot TimeOfDay) IsAfter(other TimeOfDay) bool

IsAfter returns True iff ot is after other. Ignores everything except hour and minute fields.

func (TimeOfDay) IsBefore

func (ot TimeOfDay) IsBefore(other TimeOfDay) bool

IsBefore returns True iff ot is before other. Ignores everything except hour and minute fields.

func (TimeOfDay) OnDate

func (ot TimeOfDay) OnDate(date time.Time) time.Time

OnDate returns the time of day in the local timezone on the given date.

func (*TimeOfDay) Scan

func (ot *TimeOfDay) Scan(value interface{}) error

Scan updates this TimeOfDay from the value stored in a database.

func (TimeOfDay) String

func (ot TimeOfDay) String() string

func (TimeOfDay) Value

func (ot TimeOfDay) Value() (driver.Value, error)

Value converts a TimeOfDay to a value usable by SQL databases.

type Worker

type Worker struct {
	Model
	DeletedAt sql.NullTime

	UUID   string
	Secret string
	Name   string

	Address    string // 39 = max length of IPv6 address.
	Platform   string
	Software   string
	Status     api.WorkerStatus
	LastSeenAt time.Time // Should contain UTC timestamps.
	CanRestart bool

	StatusRequested   api.WorkerStatus
	LazyStatusRequest bool

	SupportedTaskTypes string // comma-separated list of task types.

	Tags []*WorkerTag
}

func (*Worker) Identifier

func (w *Worker) Identifier() string

func (*Worker) StatusChangeClear

func (w *Worker) StatusChangeClear()

StatusChangeClear clears the requested status change of the Worker. This just updates the Worker instance, but doesn't store the change in the database.

func (*Worker) StatusChangeRequest

func (w *Worker) StatusChangeRequest(status api.WorkerStatus, isLazyRequest bool)

StatusChangeRequest stores a requested status change on the Worker. This just updates the Worker instance, but doesn't store the change in the database.

func (*Worker) TaskTypes

func (w *Worker) TaskTypes() []string

TaskTypes returns the worker's supported task types as list of strings.

type WorkerStatusCount

type WorkerStatusCount map[api.WorkerStatus]int

WorkerStatusCount is a mapping from job status to the number of jobs in that status.

type WorkerTag

type WorkerTag struct {
	Model

	UUID        string
	Name        string
	Description string

	Workers []*Worker
}

type WorkerTestFixture

type WorkerTestFixture struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL