Help us shape the future of Go! Take the 2026 Go Developer Survey

dagspec

package
v0.5.8-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dagspec validates a compiled dag.json with the rules the engine applies when the DAG is registered, so a service that registers DAGs through the API can refuse a bad one before it sends it (#1877).

It works on the dag.json bytes, the same document POST /api/v2/dags/{dag_id}/dagVersions takes, and depends on no storage, server or API code. Validate covers what holds on every install: the JSON Schema, the task graph, params, execution metadata, placement, resource quantities and the cron schedule. CheckLimits adds the per-tenant limits an operator may set (min_schedule_interval_seconds and max_task_pool_slots). What depends on the server's own configuration (the resource unit, deploy.require_digest, source mode and the execution allowlist) and max_dags, which needs the tenant's count, are checked only by the server.

Index

Constants

This section is empty.

Variables

View Source
var ErrLimitExceeded = domain.ErrLimitExceeded

ErrLimitExceeded is what CheckLimits returns, wrapped, when the DAG goes past one of the tenant limits. The server refuses the same DAG with 403.

Functions

func CheckLimits

func CheckLimits(dagJSON []byte, l Limits) error

CheckLimits validates dagJSON as Validate does, then checks it against the tenant limits l. A limit the DAG goes past wraps ErrLimitExceeded, with the same message the server answers.

func MinScheduleInterval

func MinScheduleInterval(schedule string) (gap time.Duration, ok bool)

MinScheduleInterval returns the shortest gap a schedule leaves between two runs, the figure min_schedule_interval_seconds is compared with. ok is false when the schedule never fires on a cron (empty, @once, @continuous, a date that does not exist) or does not parse.

func Schema

func Schema() []byte

Schema returns the JSON Schema of dag.json that Validate applies, for a caller that validates in another language or shows it to an author.

func Validate

func Validate(dagJSON []byte) error

Validate reports whether dagJSON is a dag.json the engine registers, and every rule it breaks otherwise. A schedule that does not parse as a cron is refused here, as `dexaflow compile` refuses it: the server registers such a DAG but never schedules it.

Types

type Limits

type Limits struct {
	// MinScheduleIntervalSeconds is the shortest gap, in seconds, the DAG's
	// schedule may leave between two runs.
	MinScheduleIntervalSeconds int
	// MaxTaskPoolSlots caps a task's pool_slots.
	MaxTaskPoolSlots int
}

Limits are the tenant limits a dag.json is checked against. A zero field is unlimited, as on a tenant created without limits.

Jump to

Keyboard shortcuts

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