Documentation
¶
Index ¶
- func LogMessage(msg string, client pb.TaskQueueClient, taskID int32)
- func ReportInstallError(c pb.TaskQueueClient, workerName, msg string, err error, ctx context.Context)
- func SendRuntimeEventWithRetry(serverAddr, token string, workerID int32, workerName, level, class, msg string, ...)
- type Reporter
- func (r *Reporter) Event(level, class, msg string, details map[string]any)
- func (r *Reporter) QueueLog(taskID int32, msg string)
- func (r *Reporter) StopOutbox()
- func (r *Reporter) UpdateTask(taskID int32, status string, logMessage string, failureClass string) error
- func (r *Reporter) UpdateTaskAsync(taskID int32, status, msg string, duration *int32, failureClass string)
- func (r *Reporter) UpdateTaskAsyncWithPeaks(taskID int32, status, msg string, duration *int32, failureClass string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogMessage ¶
func LogMessage(msg string, client pb.TaskQueueClient, taskID int32)
send simple log message
func ReportInstallError ¶
func SendRuntimeEventWithRetry ¶
func SendRuntimeEventWithRetry(serverAddr, token string, workerID int32, workerName, level, class, msg string, details map[string]any)
in cmd/client (or client/event), mirroring sendInstallErrorWithRetry prefer using the Reporter struct instead: this function is used in case ther Reporter is not available
Types ¶
type Reporter ¶
type Reporter struct {
Client pb.TaskQueueClient
WorkerID int32
WorkerName string
Timeout time.Duration // per-call timeout, e.g. 5s
// contains filtered or unexported fields
}
Reporter now manages per-task workers instead of a global outbox.
func NewReporter ¶
func NewReporter(client pb.TaskQueueClient, workerID int32, workerName string, timeout time.Duration) *Reporter
NewReporter constructs a Reporter; workers are created lazily per task on first update.
func (*Reporter) StopOutbox ¶
func (r *Reporter) StopOutbox()
StopOutbox stops all per-task workers. This is best-effort and returns after workers have exited their current send (bounded by per-RPC timeout).
func (*Reporter) UpdateTask ¶
func (r *Reporter) UpdateTask(taskID int32, status string, logMessage string, failureClass string) error
UpdateTask is the synchronous status-update helper. Pass `failureClass` (oom / timeout / network / other) on terminal F transitions so the server's retry-decision path can advance the resource-escalation curve appropriately; pass "" otherwise.
func (*Reporter) UpdateTaskAsync ¶
func (r *Reporter) UpdateTaskAsync(taskID int32, status, msg string, duration *int32, failureClass string)
UpdateTaskAsync enqueues the latest desired status for a task. Newer updates overwrite any queued older one (latest-wins coalescing). Sending is serialized per task by its worker.
failureClass is set on terminal F transitions to classify the failure (oom / timeout / network / other). The retry-decision path on the server consults this when deciding to advance the resource-escalation curve — eviction (server-declared) and unset both leave the curve alone. Pass "" when the transition isn't a classified failure (success, intermediate statuses, transient updates).
func (*Reporter) UpdateTaskAsyncWithPeaks ¶ added in v0.9.3
func (r *Reporter) UpdateTaskAsyncWithPeaks(taskID int32, status, msg string, duration *int32, failureClass string, peakMemMB int32)
UpdateTaskAsyncWithPeaks is UpdateTaskAsync with the terminal-time per-task counters. peakMemMB=0 is the "not observed" sentinel and is omitted on the wire (server persists NULL). Called from the executor once the container / bare-process is confirmed done, so the cgroup counter or /proc entry is still readable at the moment we sample it.