Documentation
¶
Overview ¶
Package shell_task 提供了一个简单而灵活的任务调度系统
Index ¶
Constants ¶
View Source
const ( PriorityLow = scheduler.PriorityLow PriorityNormal = scheduler.PriorityNormal PriorityHigh = scheduler.PriorityHigh )
预定义优先级常量
Variables ¶
View Source
var ( // 基本选项 WithName = scheduler.WithName WithJob = scheduler.WithJob WithTimeout = scheduler.WithTimeout WithRepeat = scheduler.WithRepeat WithMaxRuns = scheduler.WithMaxRuns WithRetry = scheduler.WithRetry WithParallelism = scheduler.WithParallelism WithLogger = scheduler.WithLogger WithLoggerFunc = scheduler.WithLoggerFunc WithRecover = scheduler.WithRecover WithStartupDelay = scheduler.WithStartupDelay WithPreHook = scheduler.WithPreHook WithPostHook = scheduler.WithPostHook WithErrorHandler = scheduler.WithErrorHandler WithCancelOnFailure = scheduler.WithCancelOnFailure WithMetricCollector = scheduler.WithMetricCollector // 优先级和资源限制选项 WithPriority = scheduler.WithPriority WithResourceLimits = scheduler.WithResourceLimits WithMaxCPU = scheduler.WithMaxCPU WithMaxMemory = scheduler.WithMaxMemory WithMaxExecutionTime = scheduler.WithMaxExecutionTime )
导出所有任务配置选项
Functions ¶
This section is empty.
Types ¶
type Logger ¶ added in v0.1.1
Logger 定义了日志接口,支持不同级别的日志记录
func NewFuncLogger ¶ added in v0.1.1
NewFuncLogger 创建一个新的函数式日志适配器 用于将单一日志函数转换为 Logger 接口,兼容旧的日志函数
type ResourceLimits ¶ added in v0.1.1
type ResourceLimits = scheduler.ResourceLimits
ResourceLimits 定义任务资源限制
type WorkerPool ¶ added in v0.1.1
type WorkerPool = scheduler.WorkerPool
WorkerPool 表示一个工作池,用于限制并发执行的任务数量
func NewWorkerPool ¶ added in v0.1.1
func NewWorkerPool(size int, logger Logger) *WorkerPool
NewWorkerPool 创建一个新的工作池
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
shelltask
command
cmd/shelltask/main.go
|
cmd/shelltask/main.go |
|
examples
|
|
|
cancellation-example
command
examples/cancellation-example/main.go
|
examples/cancellation-example/main.go |
|
logger-example
command
examples/logger-example/main.go
|
examples/logger-example/main.go |
|
simple-example
command
examples/simple_example.go
|
examples/simple_example.go |
|
timeout-example
command
examples/timeout-example/main.go
|
examples/timeout-example/main.go |
|
worker-pool-example
command
examples/worker-pool-example/main.go
|
examples/worker-pool-example/main.go |
|
scheduler/logger.go
|
scheduler/logger.go |
Click to show internal directories.
Click to hide internal directories.