executor

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorContextLines = defaultErrorContextLines

ErrorContextLines is the number of stderr lines to include in error details. Set via config; falls back to defaultErrorContextLines.

View Source
var GracePeriod = defaultGracePeriod

GracePeriod is the time allowed for a process to exit after signal. Set via config; falls back to defaultGracePeriod.

View Source
var (
	// OutputMarkerRe matches ::daggle-output name=<key>::<value> markers in step stdout.
	OutputMarkerRe = regexp.MustCompile(`^::daggle-output name=([a-zA-Z_][a-zA-Z0-9_]*)::(.*)$`)
)

Functions

func WriteApprovalEvent

func WriteApprovalEvent(runDir, stepID string, approved bool) error

WriteApprovalEvent writes an approval or rejection event to a run's events.jsonl.

Types

type ApproveExecutor

type ApproveExecutor struct{}

ApproveExecutor blocks until a human approves or rejects via CLI.

func (*ApproveExecutor) Run

func (e *ApproveExecutor) Run(ctx context.Context, step dag.Step, logDir string, _ string, _ []string) Result

Run writes a waiting_approval event and polls for approval/rejection.

type CallExecutor

type CallExecutor struct{}

CallExecutor executes another DAG as a sub-DAG by invoking daggle recursively.

func (*CallExecutor) Run

func (e *CallExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run invokes daggle run for the referenced sub-DAG.

type ConnectExecutor

type ConnectExecutor struct{}

ConnectExecutor deploys content to Posit Connect via the rsconnect R package.

func (*ConnectExecutor) Run

func (e *ConnectExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code to deploy to Posit Connect and executes it via Rscript.

type DatabaseExecutor added in v0.3.0

type DatabaseExecutor struct{}

DatabaseExecutor runs a SQL query via R DBI and writes the result to disk.

func (*DatabaseExecutor) Run added in v0.3.0

func (e *DatabaseExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code that connects to the database, runs the query, and writes the result set in the format inferred from the output extension.

type DockerExecutor added in v0.3.0

type DockerExecutor struct{}

DockerExecutor runs a command inside a Docker container. The command is supervised like any other subprocess — the outer `docker run` process gets the same signal handling, log capture, and timeout behavior as shell steps.

func (*DockerExecutor) Run added in v0.3.0

func (e *DockerExecutor) Run(ctx context.Context, step dag.Step, logDir, workdir string, env []string) Result

Run builds and executes a `docker run --rm ...` invocation.

type EmailExecutor added in v0.3.0

type EmailExecutor struct{}

EmailExecutor sends an email via a named SMTP notification channel. Runs entirely in-process via net/smtp — no R, no subprocess.

func (*EmailExecutor) Run added in v0.3.0

func (e *EmailExecutor) Run(_ context.Context, step dag.Step, logDir, workdir string, _ []string) Result

Run builds a multipart MIME message and sends it via the configured SMTP channel. Attachment paths are resolved relative to the step's workdir.

type Executor

type Executor interface {
	Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result
}

Executor runs a single DAG step.

func New

func New(step dag.Step) Executor

New returns the appropriate executor for the given step type.

type InlineRExecutor

type InlineRExecutor struct{}

InlineRExecutor writes an R expression to a temp file and runs it via Rscript.

func (*InlineRExecutor) Run

func (e *InlineRExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run writes the R expression to a temp file and executes it via Rscript.

type MetaEntry

type MetaEntry struct {
	Name  string
	Type  string // "numeric", "text", "table", "image"
	Value string
}

MetaEntry holds a metadata entry emitted via ::daggle-meta:: markers.

type PinExecutor

type PinExecutor struct{}

PinExecutor publishes data/models via the pins R package.

func (*PinExecutor) Run

func (e *PinExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code to pin an object and executes it via Rscript.

type QuartoExecutor

type QuartoExecutor struct{}

QuartoExecutor renders Quarto documents or projects.

func (*QuartoExecutor) Run

func (e *QuartoExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run executes quarto render with the specified path and arguments.

type RPkgExecutor

type RPkgExecutor struct {
	Action string // "test", "check", "document", "lint", "style", "renv_restore", "coverage", "shinytest", "pkgdown", "install", "targets", "benchmark", "revdepcheck"
}

RPkgExecutor runs R package development actions via Rscript.

func (*RPkgExecutor) Run

func (e *RPkgExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code for the given action and executes it via Rscript.

type Result

type Result struct {
	ExitCode    int
	Stdout      string // path to stdout log file
	Stderr      string // path to stderr log file
	Duration    time.Duration
	Err         error
	Outputs     map[string]string  // parsed ::daggle-output:: values
	ErrorDetail string             // extracted error message from stderr (R, Quarto, or last lines)
	Summaries   []Summary          // parsed ::daggle-summary:: values
	Metadata    []MetaEntry        // parsed ::daggle-meta:: values
	Validations []ValidationResult // parsed ::daggle-validation:: values

	// Resource usage captured from syscall.Rusage after cmd.Wait().
	// Zero when unavailable (timeout, start failure, unsupported platform).
	PeakRSSKB  int64   // peak resident set size in KB (normalized across platforms)
	UserCPUSec float64 // user CPU time in seconds
	SysCPUSec  float64 // system CPU time in seconds
}

Result holds the outcome of executing a step.

type RmdExecutor

type RmdExecutor struct{}

RmdExecutor renders R Markdown documents via rmarkdown::render().

func (*RmdExecutor) Run

func (e *RmdExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code to render the Rmd file and executes it via Rscript.

type ScriptExecutor

type ScriptExecutor struct{}

ScriptExecutor runs an R script via Rscript.

func (*ScriptExecutor) Run

func (e *ScriptExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run executes the R script via Rscript.

type ShellExecutor

type ShellExecutor struct{}

ShellExecutor runs a shell command via sh -c.

func (*ShellExecutor) Run

func (e *ShellExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run executes the shell command via sh -c.

type Summary

type Summary struct {
	Format  string // "markdown"
	Content string
}

Summary holds a step summary emitted via ::daggle-summary:: markers.

type ValidateExecutor

type ValidateExecutor struct{}

ValidateExecutor runs a data validation R script via Rscript. Same execution as ScriptExecutor — kept as a distinct type so DAG validation, status output, and editor autocomplete can distinguish the two step kinds.

func (*ValidateExecutor) Run

func (e *ValidateExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run executes the validation script via Rscript.

type ValidationResult

type ValidationResult struct {
	Name    string
	Status  string // "pass", "warn", "fail"
	Message string
}

ValidationResult holds a validation result emitted via ::daggle-validation:: markers.

type VetiverExecutor

type VetiverExecutor struct{}

VetiverExecutor handles MLOps model versioning/deployment via the vetiver R package.

func (*VetiverExecutor) Run

func (e *VetiverExecutor) Run(ctx context.Context, step dag.Step, logDir string, workdir string, env []string) Result

Run generates R code for vetiver operations and executes it via Rscript.

Jump to

Keyboard shortcuts

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