Documentation ¶
Index ¶
- Variables
- func NonRetriable(err error) error
- type Controller
- type ITask
- type Options
- type Pipe
- type PipeAny
- type PipeMode
- type PipeOrdered
- type PipeParallel
- type PipeRace
- type Report
- type Status
- func (s Status) Error() string
- func (s Status) Icon() string
- func (s Status) IsAlive() bool
- func (s Status) IsDead() bool
- func (s Status) IsError() bool
- func (s Status) IsTransition() bool
- func (s Status) Join(err error) error
- func (s Status) MarshalJSON() ([]byte, error)
- func (s Status) String() string
- func (s *Status) UnmarshalJSON(data []byte) (err error)
- type StatusOrError
- type Task
- type TaskEx
- type TaskFetch
- type TaskNoop
- type TaskRun
- type TaskWait
- type TaskWithOpts
- type Whiteboard
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNonRetriable = errors.New("non-retriable error")
View Source
var PipeModes = [...]PipeMode{ PipeOrdered{}, PipeParallel{}, PipeRace{}, PipeAny{}, }
PipeModes is a list of all pipe modes.
View Source
var Registry = automarshal.NewRegistry[Task, ITask]()
Functions ¶
func NonRetriable ¶
Types ¶
type Controller ¶
type ITask ¶
type ITask interface {
Launch(Controller) (exitReason <-chan error)
}
type Options ¶
type Options struct { RetryDisabled bool `json:"retry_disabled,omitempty"` // If set no restarts will be attempted if the process fails to start initially. RetryBackoff util.ParsableDuration `json:"retry_backoff,omitempty"` // The time to wait between retries. RetryBackoffScale float64 `json:"retry_backoff_scale,omitempty"` // The scale factor to apply to the retry backoff. RetrySuccess bool `json:"retry_success,omitempty"` // If set the process will be restarted even if it exits with status 0. RetryLimit util.TimerRate `json:"retry_limit,omitempty"` // Maximum number of consequtive restarts within the period before the process is considered "errored". MaxMemory util.ParsableSize `json:"max_memory,omitempty"` // Maximum amount of memory the process is allowed to use, <= 0 means unlimited. MinUptime util.ParsableDuration `json:"min_uptime,omitempty"` // Minimum uptime of the process before it is considered "started", <= 0 means immediate. ExecTimeout util.ParsableDuration `json:"exec_timeout,omitempty"` // The time to wait for a process to exit before killing it, <= 0 means never. StartTimeout util.ParsableDuration `json:"start_timeout,omitempty"` // The time to wait for a process to start before killing it, <= 0 means never. StopTimeout util.ParsableDuration `json:"stop_timeout"` // The time to wait for a process to stop before killing it, <= 0 means immediate. }
func (*Options) WithDefaults ¶
func (o *Options) WithDefaults()
type Pipe ¶
func (*Pipe) Launch ¶
func (p *Pipe) Launch(controller Controller) (exitReason <-chan error)
type PipeAny ¶
type PipeAny struct{}
pipe:any runs all subtasks in parallel, and cancels the rest if any of them succeeds.
type PipeMode ¶
type PipeMode interface { String() string // contains filtered or unexported methods }
type PipeOrdered ¶
type PipeOrdered struct{}
pipe:ordered runs all subtasks one after another, and cancels the rest if any of them fails.
func (PipeOrdered) String ¶
func (PipeOrdered) String() string
type PipeParallel ¶
type PipeParallel struct{}
func (PipeParallel) String ¶
func (PipeParallel) String() string
type PipeRace ¶
type PipeRace struct{}
pipe:race runs all subtasks in parallel, and cancels the rest if any of them succeeds or fails.
type Report ¶
type Report struct { Pid []int32 `json:"pid"` Cpu float64 `json:"cpu"` Mem float64 `json:"mem"` Username string `json:"usr"` CreateTime time.Time `json:"create_time"` }
func InspectProcess ¶
type Status ¶
type Status uint8
Status code for session.
const ( Idle Status = iota Complete Status = iota Cancelled Status = iota Starting Status = iota | FlagAlive | FlagTransition Stopping Status = iota | FlagAlive | FlagTransition Running Status = iota | FlagAlive Retrying Status = iota | FlagAlive Errored Status = iota | FlagError TimeoutStop Status = iota | FlagError TimeoutStart Status = iota | FlagError TimeoutExec Status = iota | FlagError )
func StatusFromErr ¶
func StatusFromName ¶
func (Status) IsTransition ¶
func (Status) MarshalJSON ¶
func (*Status) UnmarshalJSON ¶
type StatusOrError ¶
type StatusOrError = error
type Task ¶
type Task struct { ITask automarshal.ID }
func (Task) MarshalJSON ¶
func (*Task) UnmarshalJSON ¶
type TaskFetch ¶
type TaskFetch struct { Url string `json:"url"` Method string `json:"method"` Body string `json:"body"` }
func (*TaskFetch) Launch ¶
func (h *TaskFetch) Launch(ctx Controller) <-chan error
func (*TaskFetch) UnmarshalInline ¶
type TaskNoop ¶
type TaskNoop struct{}
func (TaskNoop) Launch ¶
func (t TaskNoop) Launch(ctx Controller) <-chan error
type TaskRun ¶
type TaskRun struct { Foreign string `json:"-"` // The foreign language to run. Exec string `json:"exec,omitempty"` // The executable used to run the script. Args []string `json:"args,omitempty"` // Arguments passed. Cwd string `json:"cwd"` // Working directory. Env map[string]string `json:"env,omitempty"` // The environment variables to set. N int `json:"n,omitempty"` // The number of instances to launch, >1 will run as cluster with special env. Proxy *revproxy.Options `json:"proxy,omitempty"` // The proxy options. }
func (*TaskRun) Launch ¶
func (h *TaskRun) Launch(ctx Controller) <-chan error
func (*TaskRun) UnmarshalInline ¶
func (*TaskRun) WithDefaults ¶
func (t *TaskRun) WithDefaults()
type TaskWait ¶
type TaskWait struct {
Duration util.ParsableDuration `json:"duration"`
}
func (*TaskWait) Launch ¶
func (h *TaskWait) Launch(ctx Controller) <-chan error
func (*TaskWait) UnmarshalInline ¶
type TaskWithOpts ¶
type TaskWithOpts interface {
Configure(*Options)
}
type Whiteboard ¶
type Whiteboard struct {
// contains filtered or unexported fields
}
func NewWhiteboard ¶
func NewWhiteboard() Whiteboard
func WhiteboardFromContext ¶
func WhiteboardFromContext(ctx context.Context) Whiteboard
func (Whiteboard) Clear ¶
func (w Whiteboard) Clear()
func (Whiteboard) Fork ¶
func (w Whiteboard) Fork(key string) Whiteboard
func (Whiteboard) Set ¶
func (w Whiteboard) Set(key string, value any)
func (Whiteboard) WithContext ¶
func (w Whiteboard) WithContext(ctx context.Context) context.Context
Click to show internal directories.
Click to hide internal directories.