taskwatch

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package taskwatch implements live streaming output tailing for a running cloop PM task. It polls the live artifact file written by the orchestrator and streams new bytes to an io.Writer, similar to `tail -f`.

Index

Constants

View Source
const (
	ExitDone    = 0
	ExitFailed  = 1
	ExitSkipped = 2
)

ExitCode encodes the terminal task status as a process exit code.

Variables

This section is empty.

Functions

func Watch

func Watch(ctx context.Context, cfg Config) (int, error)

Watch tails live output for a running task identified by cfg.TaskID.

Behaviour:

  • If the task is pending, it waits up to cfg.Timeout for it to become in_progress.
  • While the task is in_progress it streams new bytes from the live artifact file every 100 ms.
  • When the task reaches a terminal status (done/failed/skipped/timed_out) it prints a final status banner, fires a desktop notification (unless cfg.NoNotify is true) and returns the appropriate exit code.

Returns (exitCode, error).

Types

type Config

type Config struct {
	WorkDir  string
	TaskID   int
	Timeout  time.Duration // max time to wait for the task to start; default 5m
	NoNotify bool          // suppress desktop notification on completion
	Output   io.Writer     // where to stream output; defaults to os.Stdout
}

Config controls the behaviour of Watch.

Jump to

Keyboard shortcuts

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