cmd

package
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: GPL-3.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func Cleanup() *cobra.Command

Cleanup creates and returns a cobra command for removing old DAG run history.

func CmdCoordinator added in v1.18.0

func CmdCoordinator() *cobra.Command

func CmdWorker added in v1.18.0

func CmdWorker() *cobra.Command

func Dequeue added in v1.23.0

func Dequeue() *cobra.Command

func Dry added in v1.23.0

func Dry() *cobra.Command

func Enqueue added in v1.23.0

func Enqueue() *cobra.Command

func Exec added in v1.24.0

func Exec() *cobra.Command

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 Migrate added in v1.23.0

func Migrate() *cobra.Command

Migrate creates the migrate command with subcommands

func MigrateHistoryCommand added in v1.17.0

func MigrateHistoryCommand() *cobra.Command

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 Restart added in v1.23.0

func Restart() *cobra.Command

func Retry added in v1.23.0

func Retry() *cobra.Command

func Scheduler added in v1.23.0

func Scheduler() *cobra.Command

func Server added in v1.23.0

func Server() *cobra.Command

func Start added in v1.23.0

func Start() *cobra.Command

Start creates and returns a cobra command for starting a dag-run

func StartAll added in v1.23.0

func StartAll() *cobra.Command

func Status added in v1.23.0

func Status() *cobra.Command

func Stop added in v1.23.0

func Stop() *cobra.Command

func Validate added in v1.23.0

func Validate() *cobra.Command

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.

func Version added in v1.23.0

func Version() *cobra.Command

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

func NewContext(cmd *cobra.Command, flags []commandLineFlag) (*Context, error)

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

func (c *Context) GenLogFileName(dag *core.DAG, dagRunID string) (string, error)

GenLogFileName generates a log file name based on the DAG and dag-run ID.

func (*Context) LogToFile

func (c *Context) LogToFile(f *os.File)

LogToFile creates a new logger context with a file writer.

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

func (c *Context) NewScheduler() (*scheduler.Scheduler, error)

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

func (c *Context) NewServer(rs *resource.Service) (*frontend.Server, error)

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

func (c *Context) OpenLogFile(
	dag *core.DAG,
	dagRunID string,
) (*os.File, error)

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

func (c *Context) RecordEarlyFailure(dag *core.DAG, dagRunID string, err error) error

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.

func (*Context) StringParam added in v1.17.0

func (c *Context) StringParam(name string) (string, error)

StringParam retrieves a string parameter from the command line flags. It checks if the parameter is wrapped in quotes and removes them if necessary.

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

func (cfg LogConfig) LogDir() (string, error)

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.

func (LogConfig) LogFile added in v1.17.0

func (cfg LogConfig) LogFile() string

LogFile constructs the log filename using the prefix, safe DAG name, current timestamp, and a truncated version of the dag-run ID.

func (LogConfig) Validate added in v1.17.0

func (cfg LogConfig) Validate() error

Validate checks that essential fields are provided. It requires that DAGName is not empty and that at least one log directory is specified.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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