job

package
v2.1.57 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

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

Queue Name.

View Source
const (
	// PreheatJob is the name of preheat job.
	PreheatJob = "preheat"

	// SyncPeersJob is the name of syncing peers job.
	SyncPeersJob = "sync_peers"

	// GetTaskJob is the name of getting task job.
	GetTaskJob = "get_task"

	// DeleteTaskJob is the name of deleting task job.
	DeleteTaskJob = "delete_task"
)

Job Name.

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

Machinery server configuration.

Variables

This section is empty.

Functions

func MarshalRequest

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

func MarshalResponse added in v2.0.30

func MarshalResponse(v any) (string, error)

func UnmarshalRequest

func UnmarshalRequest(data string, v any) error

func UnmarshalResponse

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

func UnmarshalTaskResult added in v2.1.57

func UnmarshalTaskResult(data any, v any) error

Types

type Config

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

type DeletePeerResponse added in v2.1.55

type DeletePeerResponse struct {
	Peer        *resource.Peer `json:"peer"`
	Description string         `json:"description"`
}

DeletePeerResponse represents the response after attempting to delete a peer.

type DeleteTaskRequest added in v2.1.55

type DeleteTaskRequest struct {
	TaskID  string        `json:"task_id" validate:"required"`
	Timeout time.Duration `json:"timeout" validate:"omitempty"`
}

DeleteTaskRequest defines the request parameters for deleting task.

type DeleteTaskResponse added in v2.1.55

type DeleteTaskResponse struct {
	SuccessPeers []*DeletePeerResponse `json:"success_peers"`
	FailurePeers []*DeletePeerResponse `json:"failure_peers"`
}

DeleteTaskResponse defines the response parameters for deleting task.

type GetTaskRequest added in v2.1.55

type GetTaskRequest struct {
	TaskID string `json:"task_id" validate:"required"`
}

GetTaskRequest defines the request parameters for getting task.

type GetTaskResponse added in v2.1.55

type GetTaskResponse struct {
	Peers []*resource.Peer `json:"peers"`
}

GetTaskResponse defines the response parameters for getting task.

type GroupJobState

type GroupJobState struct {
	GroupUUID string     `json:"group_uuid"`
	State     string     `json:"state"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	JobStates []jobState `json:"job_states"`
}

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(name string, 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 added in v2.0.1

type MachineryLogger struct{}

func (*MachineryLogger) Fatal added in v2.0.1

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

Fatal sends to logger.Fatal

func (*MachineryLogger) Fatalf added in v2.0.1

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

Fatalf sends to logger.Fatalf

func (*MachineryLogger) Fatalln added in v2.0.1

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

Fatalln sends to logger.Fatal

func (*MachineryLogger) Panic added in v2.0.1

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

Panic sends to logger.Panic

func (*MachineryLogger) Panicf added in v2.0.1

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

Panicf sends to logger.Panic

func (*MachineryLogger) Panicln added in v2.0.1

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

Panicln sends to logger.Panic

func (*MachineryLogger) Print added in v2.0.1

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

Print sends to logger.Info

func (*MachineryLogger) Printf added in v2.0.1

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

Printf sends to logger.Infof

func (*MachineryLogger) Println added in v2.0.1

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

Println sends to logger.Info

type PreheatFailureTask added in v2.1.57

type PreheatFailureTask struct {
	URL         string `json:"url"`
	Hostname    string `json:"hostname"`
	IP          string `json:"ip"`
	Description string `json:"description"`
}

PreheatFailureTask defines the response parameters for preheating failed.

type PreheatRequest

type PreheatRequest struct {
	URL                 string            `json:"url" validate:"required,url"`
	Tag                 string            `json:"tag" validate:"omitempty"`
	Digest              string            `json:"digest" validate:"omitempty"`
	FilteredQueryParams string            `json:"filtered_query_params" validate:"omitempty"`
	Headers             map[string]string `json:"headers" validate:"omitempty"`
	Application         string            `json:"application" validate:"omitempty"`
	Priority            int32             `json:"priority" validate:"omitempty"`
	Scope               string            `json:"scope" validate:"omitempty"`
	ConcurrentCount     int64             `json:"concurrent_count" validate:"omitempty"`
	Timeout             time.Duration     `json:"timeout" validate:"omitempty"`
}

PreheatRequest defines the request parameters for preheating.

type PreheatResponse

type PreheatResponse struct {
	SuccessTasks       []*PreheatSuccessTask `json:"success_tasks"`
	FailureTasks       []*PreheatFailureTask `json:"failure_tasks"`
	SchedulerClusterID uint                  `json:"scheduler_cluster_id"`
}

PreheatResponse defines the response parameters for preheating.

type PreheatSuccessTask added in v2.1.57

type PreheatSuccessTask struct {
	URL      string `json:"url"`
	Hostname string `json:"hostname"`
	IP       string `json:"ip"`
}

PreheatSuccessTask defines the response parameters for preheating successfully.

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