job

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalQueue     = Queue("global")
	SchedulersQueue = Queue("schedulers")
)

Queue Name.

View Source
const (
	DefaultResultsExpireIn     = 86400
	DefaultRedisMaxIdle        = 10
	DefaultRedisIdleTimeout    = 300
	DefaultRedisReadTimeout    = 60
	DefaultRedisWriteTimeout   = 60
	DefaultRedisConnectTimeout = 60
)

Machinery server configuration.

View Source
const (
	PreheatJob = "preheat"
)

Job Name.

Variables

This section is empty.

Functions

func MarshalRequest

func MarshalRequest(v any) ([]machineryv1tasks.Arg, error)

func UnmarshalRequest

func UnmarshalRequest(data string, v any) error

func UnmarshalResponse

func UnmarshalResponse(data []reflect.Value, v any) error

Types

type Config

type Config struct {
	Addrs      []string
	MasterName string
	Username   string
	Password   string
	BrokerDB   int
	BackendDB  int
}

type GroupJobState

type GroupJobState struct {
	GroupUUID string
	State     string
	CreatedAt time.Time
	JobStates []*machineryv1tasks.TaskState
}

type Job

type Job struct {
	Server *machinery.Server
	Worker *machinery.Worker
	Queue  Queue
}

func New

func New(cfg *Config, queue Queue) (*Job, error)

func (*Job) GetGroupJobState

func (t *Job) GetGroupJobState(groupID string) (*GroupJobState, error)

func (*Job) LaunchWorker

func (t *Job) LaunchWorker(consumerTag string, concurrency int) error

func (*Job) RegisterJob

func (t *Job) RegisterJob(namedJobFuncs map[string]any) error

type MachineryLogger

type MachineryLogger struct{}

func (*MachineryLogger) Fatal

func (m *MachineryLogger) Fatal(args ...any)

Fatal sends to logger.Fatal

func (*MachineryLogger) Fatalf

func (m *MachineryLogger) Fatalf(format string, args ...any)

Fatalf sends to logger.Fatalf

func (*MachineryLogger) Fatalln

func (m *MachineryLogger) Fatalln(args ...any)

Fatalln sends to logger.Fatal

func (*MachineryLogger) Panic

func (m *MachineryLogger) Panic(args ...any)

Panic sends to logger.Panic

func (*MachineryLogger) Panicf

func (m *MachineryLogger) Panicf(format string, args ...any)

Panicf sends to logger.Panic

func (*MachineryLogger) Panicln

func (m *MachineryLogger) Panicln(args ...any)

Panicln sends to logger.Panic

func (*MachineryLogger) Print

func (m *MachineryLogger) Print(args ...any)

Print sends to logger.Info

func (*MachineryLogger) Printf

func (m *MachineryLogger) Printf(format string, args ...any)

Printf sends to logger.Infof

func (*MachineryLogger) Println

func (m *MachineryLogger) Println(args ...any)

Println sends to logger.Info

type PreheatRequest

type PreheatRequest struct {
	URL         string            `json:"url" validate:"required,url"`
	Tag         string            `json:"tag" validate:"omitempty"`
	Digest      string            `json:"digest" validate:"omitempty"`
	Filter      string            `json:"filter" validate:"omitempty"`
	Headers     map[string]string `json:"headers" validate:"omitempty"`
	Application string            `json:"application" validate:"omitempty"`
	Priority    int32             `json:"priority" validate:"omitempty"`
}

type PreheatResponse

type PreheatResponse struct {
}

type Queue

type Queue string

func GetSchedulerQueue

func GetSchedulerQueue(clusterID uint, hostname string) (Queue, error)

func (Queue) String

func (q Queue) String() string

Jump to

Keyboard shortcuts

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