Documentation
¶
Index ¶
- func BuildLogFilename(config LogFileSettings) string
- func CmdDry() *cobra.Command
- func CmdRestart() *cobra.Command
- func CmdRetry() *cobra.Command
- func CmdScheduler() *cobra.Command
- func CmdServer() *cobra.Command
- func CmdStart() *cobra.Command
- func CmdStartAll() *cobra.Command
- func CmdStatus() *cobra.Command
- func CmdStop() *cobra.Command
- func CmdVersion() *cobra.Command
- func CreateLogFile(filepath string) (*os.File, error)
- func NewCommand(cmd *cobra.Command, flags []commandLineFlag, ...) *cobra.Command
- func SetupLogDirectory(config LogFileSettings) (string, error)
- func ValidateSettings(config LogFileSettings) error
- type Context
- func (s *Context) Client(opts ...clientOption) (client.Client, error)
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) LogToFile(f *os.File)
- func (ctx *Context) OpenLogFile(prefix string, dag *digraph.DAG, requestID string) (*os.File, error)
- func (c *Context) Value(key any) any
- type LogFileSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLogFilename ¶
func BuildLogFilename(config LogFileSettings) string
BuildLogFilename constructs the log filename using the prefix, safe DAG name, current timestamp, and a truncated version of the request ID.
func CmdRestart ¶
func CmdScheduler ¶
func CmdStartAll ¶
func CmdVersion ¶
func CreateLogFile ¶
CreateLogFile opens (or creates) the log file with flags for creation, write-only access, appending, and synchronous I/O. It sets file permissions to 0644.
func NewCommand ¶
func NewCommand(cmd *cobra.Command, flags []commandLineFlag, run func(cmd *Context, args []string) error) *cobra.Command
NewCommand creates a new command instance with the given cobra command and run function.
func SetupLogDirectory ¶
func SetupLogDirectory(config LogFileSettings) (string, error)
SetupLogDirectory creates (if necessary) and returns the log directory based on the log file settings. It uses a safe version of the DAG name to avoid issues with invalid filesystem characters.
func ValidateSettings ¶
func ValidateSettings(config LogFileSettings) error
ValidateSettings checks that essential fields are provided. It requires that DAGName is not empty and that at least one log directory is specified.
Types ¶
type Context ¶
Context holds the configuration for a command.
func NewContext ¶
NewContext creates a setup instance from an existing configuration.
func (*Context) Client ¶
Client initializes a Client using the provided options. If not supplied, it creates default DAGStore and HistoryStore instances.
func (*Context) OpenLogFile ¶
func (ctx *Context) OpenLogFile( prefix string, dag *digraph.DAG, requestID string, ) (*os.File, error)
OpenLogFile creates and opens a log file for a given DAG execution. It evaluates the log directory, validates settings, creates the log directory, builds a filename using the current timestamp and request ID, and then opens the file.
type LogFileSettings ¶
type LogFileSettings struct { Prefix string // Prefix for the log filename (e.g. "start_", "retry_"). LogDir string // Base directory for logs. DAGLogDir string // Optional alternative log directory specified by the DAG. DAGName string // Name of the DAG; used for generating a safe directory name. RequestID string // Unique request ID used in the filename. }
LogFileSettings defines configuration for log file creation.