Documentation
¶
Index ¶
- Variables
- func Cleanup() *cobra.Command
- func CmdCoordinator() *cobra.Command
- func CmdWorker() *cobra.Command
- func Dequeue() *cobra.Command
- func Dry() *cobra.Command
- func Enqueue() *cobra.Command
- func Exec() *cobra.Command
- func ExecuteAgent(ctx *Context, agentInstance *agent.Agent, dag *core.DAG, dagRunID string, ...) error
- func Migrate() *cobra.Command
- func MigrateHistoryCommand() *cobra.Command
- func NewCommand(cmd *cobra.Command, flags []commandLineFlag, ...) *cobra.Command
- func Restart() *cobra.Command
- func Retry() *cobra.Command
- func Scheduler() *cobra.Command
- func Server() *cobra.Command
- func Start() *cobra.Command
- func StartAll() *cobra.Command
- func Status() *cobra.Command
- func Stop() *cobra.Command
- func Validate() *cobra.Command
- func Version() *cobra.Command
- type Context
- func (c *Context) GenLogFileName(dag *core.DAG, dagRunID string) (string, error)
- func (c *Context) LogToFile(f *os.File)
- func (c *Context) NewCoordinatorClient() coordinator.Client
- func (c *Context) NewScheduler() (*scheduler.Scheduler, error)
- func (c *Context) NewServer(rs *resource.Service) (*frontend.Server, error)
- func (c *Context) OpenLogFile(dag *core.DAG, dagRunID string) (*os.File, error)
- func (c *Context) RecordEarlyFailure(dag *core.DAG, dagRunID string, err error) error
- func (c *Context) StringParam(name string) (string, error)
- type ExecOptions
- type LogConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDAGRunIDRequired is returned when a sub dag-run is attempted without providing a dag-run ID ErrDAGRunIDRequired = errors.New("dag-run ID must be provided for sub dag-runs") // ErrDAGRunIDFormat is returned when the provided dag-run ID is not valid ErrDAGRunIDFormat = errors.New("dag-run ID must only contain alphanumeric characters, dashes, and underscores") // ErrDAGRunIDTooLong is returned when the provided dag-run ID is too long ErrDAGRunIDTooLong = errors.New("dag-run ID length must be less than 64 characters") )
Errors for start command
Functions ¶
func Cleanup ¶ added in v1.27.0
Cleanup creates and returns a cobra command for removing old DAG run history.
func CmdCoordinator ¶ added in v1.18.0
func Exec ¶ added in v1.24.0
Exec returns the cobra command for executing inline commands without a DAG spec.
func ExecuteAgent ¶ added in v1.17.0
func ExecuteAgent(ctx *Context, agentInstance *agent.Agent, dag *core.DAG, dagRunID string, logFile *os.File) error
ExecuteAgent runs an agent with optional progress display and handles common execution logic
func MigrateHistoryCommand ¶ added in v1.17.0
MigrateHistoryCommand creates a command to migrate history data
func NewCommand ¶
func NewCommand(cmd *cobra.Command, flags []commandLineFlag, runFunc func(cmd *Context, args []string) error) *cobra.Command
NewCommand creates a new command instance with the given cobra command and run function.
func Validate ¶ added in v1.23.0
Validate creates the 'validate' CLI command that checks a DAG spec for errors.
It follows the same validation logic used by the API's UpdateDAGSpec handler: - Load the YAML without evaluation - Run DAG.Validate()
The command prints validation results and any errors found. Unlike other commands, this does NOT use NewCommand wrapper to allow proper error handling in tests without requiring subprocess patterns.
Types ¶
type Context ¶
type Context struct {
context.Context
Command *cobra.Command
Flags []commandLineFlag
Config *config.Config
Quiet bool
DAGRunStore execution.DAGRunStore
DAGRunMgr runtime.Manager
ProcStore execution.ProcStore
QueueStore execution.QueueStore
ServiceRegistry execution.ServiceRegistry
Proc execution.ProcHandle
}
Context holds the configuration for a command.
func NewContext ¶
NewContext initializes the application setup by loading configuration, NewContext creates and initializes an application Context for the given Cobra command. It binds command flags, loads configuration scoped to the command, configures logging (respecting debug, quiet, and log format settings), logs any configuration warnings, and initializes history, DAG run, proc, queue, and service registry stores and managers used by the application. NewContext returns an initialized Context or an error if flag retrieval, configuration loading, or other initialization steps fail.
func (*Context) GenLogFileName ¶ added in v1.17.0
GenLogFileName generates a log file name based on the DAG and dag-run ID.
func (*Context) NewCoordinatorClient ¶ added in v1.18.0
func (c *Context) NewCoordinatorClient() coordinator.Client
NewCoordinatorClient creates a new coordinator client using the global peer configuration.
func (*Context) NewScheduler ¶ added in v1.17.0
NewScheduler creates a new NewScheduler instance using the default client. It builds a DAG job manager to handle scheduled executions.
func (*Context) NewServer ¶ added in v1.17.0
NewServer creates and returns a new web UI NewServer. It initializes in-memory caches for DAGs and runstore, and uses them in the client.
func (*Context) OpenLogFile ¶
OpenLogFile creates and opens a log file for a given dag-run. It evaluates the log directory, validates settings, creates the log directory, builds a filename using the current timestamp and dag-run ID, and then opens the file.
func (*Context) RecordEarlyFailure ¶ added in v1.27.0
RecordEarlyFailure records a failure in the execution history before the DAG has fully started. This is used for infrastructure errors like singleton conflicts or process acquisition failures.
type ExecOptions ¶ added in v1.24.0
type ExecOptions struct {
Name string
CommandArgs []string
ShellOverride string
WorkingDir string
Env []string
DotenvFiles []string
BaseConfig string
WorkerLabels map[string]string
}
ExecOptions captures the inline configuration for building an ad-hoc DAG.
type LogConfig ¶ added in v1.17.0
type LogConfig struct {
BaseDir string // Base directory for logs.
DAGLogDir string // Optional alternative log directory specified by the DAG definition.
Name string // Name of the DAG; used for generating a safe directory name.
DAGRunID string // Unique dag-run ID used in the filename.
}
LogConfig defines configuration for log file creation.
func (LogConfig) LogDir ¶ added in v1.17.0
LogDir 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.