Documentation
¶
Index ¶
- Variables
- func Cleanup() *cobra.Command
- func CmdCoordinator() *cobra.Command
- func CmdWorker() *cobra.Command
- func Config() *cobra.Command
- func ContextCommand() *cobra.Command
- func Dequeue() *cobra.Command
- func Dry() *cobra.Command
- func Enqueue() *cobra.Command
- func Example() *cobra.Command
- func ExampleCount() int
- func Exec() *cobra.Command
- func ExecuteAgent(ctx *Context, agentInstance *agent.Agent, dag *core.DAG, dagRunID string, ...) error
- func History() *cobra.Command
- func HumanTask() *cobra.Command
- func License() *cobra.Command
- func Ls() *cobra.Command
- func NewCommand(cmd *cobra.Command, flags []commandLineFlag, ...) *cobra.Command
- func Profile() *cobra.Command
- func Ps() *cobra.Command
- func Restart() *cobra.Command
- func Retry() *cobra.Command
- func Rm() *cobra.Command
- func Scheduler() *cobra.Command
- func Schema() *cobra.Command
- func Server(serverOpts ...frontend.ServerOption) *cobra.Command
- func Start() *cobra.Command
- func StartAll() *cobra.Command
- func Status() *cobra.Command
- func Stop() *cobra.Command
- func Sync() *cobra.Command
- func Upgrade() *cobra.Command
- func Validate() *cobra.Command
- func Version() *cobra.Command
- type Context
- func (c *Context) GenArtifactDir(dag *core.DAG, dagRunID string) (string, error)
- func (c *Context) GenLogFileName(dag *core.DAG, dagRunID string) (string, error)
- func (c *Context) IsRemote() bool
- 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, opts ...frontend.ServerOption) (*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)
- func (c *Context) SubWorkflowRunnerFactory() func(context.Context) (runtimeexec.SubWorkflowRunner, error)
- func (c *Context) WithContext(ctx context.Context) *Context
- func (c *Context) WithEventSource(service string) *Context
- type ExecOptions
- type LogConfig
- type RemoteProgressDisplay
- func (p *RemoteProgressDisplay) GetLastStatus() *exec.DAGRunStatus
- func (p *RemoteProgressDisplay) PrintSummary()
- func (p *RemoteProgressDisplay) SetCancelled()
- func (p *RemoteProgressDisplay) Start()
- func (p *RemoteProgressDisplay) Stop()
- func (p *RemoteProgressDisplay) Update(status *exec.DAGRunStatus)
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") )
Errors for start command
Functions ¶
func Cleanup ¶
Cleanup creates and returns a cobra command for removing old DAG run history. Deprecated: prefer `dagu rm --history`. Kept as a compatibility alias.
func CmdCoordinator ¶
func ContextCommand ¶
func ExecuteAgent ¶
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 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 Rm ¶ added in v2.11.3
Rm creates and returns a cobra command for removing DAG history and/or definitions.
func Schema ¶
Schema creates the 'schema' CLI command that displays JSON schema documentation for DAG definitions or configuration.
func Validate ¶
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
Scope commandScope
EventService *eventstore.Service
EventSourceInstance string
DAGRunStore exec.DAGRunStore
DAGRunMgr runtime.Manager
ProcStore exec.ProcStore
QueueStore exec.QueueStore
StateStore dagstate.Store
ServiceRegistry exec.ServiceRegistry
DispatchTaskStore exec.DispatchTaskStore
WorkerHeartbeatStore exec.WorkerHeartbeatStore
DAGRunLeaseStore exec.DAGRunLeaseStore
ActiveDistributedRunStore exec.ActiveDistributedRunStore
DAGStore exec.DAGStore
Proc exec.ProcHandle
LicenseManager *license.Manager
ContextStore *clicontext.Store
CLIContext *clicontext.Context
ContextName string
Remote *remoteClient
}
Context holds the configuration for a command.
func NewContext ¶
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. Returns an initialized Context or an error if flag retrieval, configuration loading, or other initialization steps fail.
func (*Context) GenArtifactDir ¶
GenArtifactDir generates an artifact directory path for the DAG run when artifacts are enabled.
func (*Context) GenLogFileName ¶
GenLogFileName generates a log file name based on the DAG and dag-run ID.
func (*Context) NewCoordinatorClient ¶
func (c *Context) NewCoordinatorClient() coordinator.Client
NewCoordinatorClient creates a new coordinator client using the global peer configuration. Returns nil when the coordinator is disabled via configuration.
func (*Context) NewScheduler ¶
NewScheduler creates a scheduler for this command context.
func (*Context) NewServer ¶
func (c *Context) NewServer(rs *resource.Service, opts ...frontend.ServerOption) (*frontend.Server, error)
NewServer creates and returns a new web UI server for this command context.
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 ¶
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 ¶
StringParam retrieves a string parameter from the command line flags. It checks if the parameter is wrapped in quotes and removes them if necessary.
func (*Context) SubWorkflowRunnerFactory ¶
func (c *Context) SubWorkflowRunnerFactory() func(context.Context) (runtimeexec.SubWorkflowRunner, error)
func (*Context) WithContext ¶
WithContext returns a new Context with a different underlying context.Context. This is useful for creating a signal-aware context for service operations.
func (*Context) WithEventSource ¶
WithEventSource returns a shallow copy whose context carries the given event source. If the event store is not configured, the original context is preserved.
type ExecOptions ¶
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 RemoteProgressDisplay ¶
type RemoteProgressDisplay struct {
// contains filtered or unexported fields
}
RemoteProgressDisplay displays progress for distributed DAG execution. It polls the coordinator for status updates and renders a progress display similar to the local SimpleProgressDisplay.
func NewRemoteProgressDisplay ¶
func NewRemoteProgressDisplay(dag *core.DAG, dagRunID string) *RemoteProgressDisplay
NewRemoteProgressDisplay creates a new remote progress display.
func (*RemoteProgressDisplay) GetLastStatus ¶
func (p *RemoteProgressDisplay) GetLastStatus() *exec.DAGRunStatus
GetLastStatus returns the last known status.
func (*RemoteProgressDisplay) PrintSummary ¶
func (p *RemoteProgressDisplay) PrintSummary()
PrintSummary prints the final tree summary.
func (*RemoteProgressDisplay) SetCancelled ¶
func (p *RemoteProgressDisplay) SetCancelled()
SetCancelled updates the status to Aborted when cancellation is requested.
func (*RemoteProgressDisplay) Start ¶
func (p *RemoteProgressDisplay) Start()
Start prints the initial header and starts the animation loop.
func (*RemoteProgressDisplay) Stop ¶
func (p *RemoteProgressDisplay) Stop()
Stop stops the display and prints final status.
func (*RemoteProgressDisplay) Update ¶
func (p *RemoteProgressDisplay) Update(status *exec.DAGRunStatus)
Update updates the display with new status from coordinator.
Source Files
¶
- agent_executor.go
- cleanup.go
- command_scope.go
- config.go
- context.go
- context_command.go
- coord.go
- dequeue.go
- dry.go
- enqueue.go
- example.go
- exec.go
- exec_spec.go
- flags.go
- helper.go
- history.go
- human_task.go
- license.go
- local_execution.go
- ls.go
- params_validation.go
- profile.go
- profile_flag.go
- progress_remote.go
- ps.go
- remote_client.go
- remote_commands.go
- restart.go
- retry.go
- rm.go
- scheduler.go
- schema.go
- server.go
- start.go
- start_params.go
- start_tools.go
- startall.go
- status.go
- stop.go
- sync.go
- upgrade.go
- validate.go
- version.go
- worker.go
- worker_attempt.go