taskstatus

package
v2.31.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TemplateID is the template ID to use for creating the external workspace.
	TemplateID uuid.UUID `json:"template_id"`

	// WorkspaceName is the name for the external workspace to create.
	WorkspaceName string `json:"workspace_name"`

	// AppSlug is the slug of the app designated as the AI Agent.
	AppSlug string `json:"app_slug"`

	// When the runner has connected to the watch-ws endpoint, it will call Done once on this wait group. Used to
	// coordinate multiple runners from the higher layer.
	ConnectedWaitGroup *sync.WaitGroup `json:"-"`

	// We read on this channel before starting to report task statuses. Used to coordinate multiple runners from the
	// higher layer.
	StartReporting chan struct{} `json:"-"`

	// Time between reporting task statuses.
	ReportStatusPeriod time.Duration `json:"report_status_period"`

	// Total time to report task statuses, starting from when we successfully read from the StartReporting channel.
	ReportStatusDuration time.Duration `json:"report_status_duration"`

	Metrics           *Metrics `json:"-"`
	MetricLabelValues []string `json:"metric_label_values"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Metrics

type Metrics struct {
	TaskStatusToWorkspaceUpdateLatencySeconds prometheus.HistogramVec
	MissingStatusUpdatesTotal                 prometheus.CounterVec
	ReportTaskStatusErrorsTotal               prometheus.CounterVec
}

func NewMetrics

func NewMetrics(reg prometheus.Registerer, labelNames ...string) *Metrics

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(coderClient *codersdk.Client, cfg Config) *Runner

NewRunner creates a new Runner with the provided codersdk.Client and configuration.

func (*Runner) Cleanup

func (r *Runner) Cleanup(ctx context.Context, id string, logs io.Writer) error

Cleanup deletes the external workspace created by this runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, name string, logs io.Writer) error

Jump to

Keyboard shortcuts

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