jobmonitor

package
v0.0.0-...-d01dfd4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const JobServicePool = "JobService"

JobServicePool job service pool name

Variables

This section is empty.

Functions

This section is empty.

Types

type JobServiceMonitorClient

type JobServiceMonitorClient interface {
	// WorkerPoolHeartbeats retrieves worker pool heartbeats
	WorkerPoolHeartbeats() ([]*work.WorkerPoolHeartbeat, error)
	// WorkerObservations retrieves worker observations
	WorkerObservations() ([]*work.WorkerObservation, error)
	// Queues retrieves the job queue information
	Queues() ([]*work.Queue, error)
}

JobServiceMonitorClient the interface to retrieve job service monitor metrics

type PoolManager

type PoolManager interface {
	// List retrieves pools information
	List(ctx context.Context, monitorClient JobServiceMonitorClient) ([]*WorkerPool, error)
}

PoolManager the interface to retrieve job service monitor metrics

func NewPoolManager

func NewPoolManager() PoolManager

NewPoolManager create a PoolManager with namespace and redis Pool

type Queue

type Queue struct {
	JobType string
	Count   int64
	Latency int64
	Paused  bool
}

Queue the job queue

type QueueManager

type QueueManager interface {
	List(ctx context.Context, monitClient JobServiceMonitorClient) ([]*Queue, error)
}

QueueManager defines the operation related to job service queue

func NewQueueClient

func NewQueueClient() QueueManager

NewQueueClient ...

type RedisClient

type RedisClient interface {
	// AllJobTypes returns all the job types registered in the job service
	AllJobTypes(ctx context.Context) ([]string, error)
	// PauseJob pause the execution of the specified type job, except the running job
	PauseJob(ctx context.Context, jobName string) error
	// UnpauseJob resume the execution of the specified type job
	UnpauseJob(ctx context.Context, jobName string) error
	// StopPendingJobs stop the pending jobs of the specified type, and remove the jobs from the waiting queue
	StopPendingJobs(ctx context.Context, jobType string) (jobIDs []string, err error)
}

RedisClient defines the job service operations related to redis

func JobServiceRedisClient

func JobServiceRedisClient() (RedisClient, error)

JobServiceRedisClient function to create redis client for job service

func NewRedisClient

func NewRedisClient(config *config.RedisPoolConfig) (RedisClient, error)

NewRedisClient create a redis client

type Worker

type Worker struct {
	ID        string `json:"id"`
	PoolID    string `json:"pool_id"`
	IsBusy    bool   `json:"is_busy"`
	JobName   string `json:"job_name"`
	JobID     string `json:"job_id"`
	StartedAt int64  `json:"start_at"`
	CheckIn   string `json:"check_in"`
	CheckInAt int64  `json:"check_in_at"`
}

Worker job service worker

type WorkerManager

type WorkerManager interface {
	// List lists all workers in the specified pool
	List(ctx context.Context, monitClient JobServiceMonitorClient, poolID string) ([]*Worker, error)
}

WorkerManager ...

func NewWorkerManager

func NewWorkerManager() WorkerManager

NewWorkerManager ...

type WorkerPool

type WorkerPool struct {
	ID          string `json:"pool_id"`
	PID         int    `json:"pid"`
	StartAt     int64  `json:"start_at"`
	HeartbeatAt int64  `json:"heartbeat_at"`
	Concurrency int    `json:"concurrency"`
	Host        string `json:"host"`
}

WorkerPool job service worker pool

Jump to

Keyboard shortcuts

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