api

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package api provieds information about Scheduler HTTP endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes() map[EndpointID]Endpoint

Routes for all Scheduler server endpoints.

Types

type DagRunRestartInput added in v0.0.11

type DagRunRestartInput struct {
	DagId  string `json:"dagId"`
	ExecTs string `json:"execTs"`
}

DagRunRestartInput defines input structure for restarting DAG run.

type DagRunTaskStatus

type DagRunTaskStatus struct {
	DagId   string  `json:"dagId"`
	ExecTs  string  `json:"execTs"`
	TaskId  string  `json:"taskId"`
	Retry   int     `json:"retry"`
	Status  string  `json:"status"`
	TaskErr *string `json:"taskError"`
}

DagRunTaskStatus contains information about DAG run task status and potential execution error.

type DagRunTriggerInput added in v0.0.10

type DagRunTriggerInput struct {
	DagId string `json:"dagId"`
}

DagRunTriggerInput defines input structure for scheduling new DAG run execution.

type Endpoint

type Endpoint struct {
	RoutePattern string
	UrlSuffix    string
}

Endpoint contains information about an HTTP endpoint.

type EndpointID

type EndpointID int

Identifier for Scheduler server endpoints.

const (
	// Endpoint for taking the first task to be executed from Scheduler
	// internal queue.
	EndpointDagTaskPop EndpointID = iota

	// Endpoint for updating status of given DAG run task.
	EndpointDagTaskUpdate

	// Endpoint for scheduling new DAG run (externally).
	EndpointDagRunTrigger

	// Endpoint for restarting DAG run (externally).
	EndpointDagRunRestart

	// Endpoint return current status of Scheduler.
	EndpointState

	// Endpoint returns statistics on DAG runs and scheduler queues.
	EndpointUiDagrunStats

	// Endpoint returns data on N latest DAG runs.
	EndpointUiDagrunLatest

	// Endpoint returns detailed data on given DAG run.
	EndpointUiDagrunDetails

	// Endpoint returns DAG run task information for single task.
	EndpointUiDagrunTaskDetails
)

type StatusCounts

type StatusCounts struct {
	Success   int `json:"success"`
	Failed    int `json:"failed"`
	Scheduled int `json:"scheduled"`
	Running   int `json:"running"`
}

StatusCounts keeps mapping between statuses (of dagruns, task execution, etc) and their frequencies.

type TaskPos added in v0.0.7

type TaskPos struct {
	Depth int `json:"depth"`
	Width int `json:"width"`
}

TaskPos represents a Task position in a DAG. Root starts in (D=1,W=1).

type TaskToExec

type TaskToExec struct {
	DagId  string `json:"dagId"`
	ExecTs string `json:"execTs"`
	TaskId string `json:"taskId"`
	Retry  int    `json:"retry"`
}

TaskToExec contains information about a task which is scheduled to be executed. Primarily to communicate between Scheduler and Executors.

type Timestamp

type Timestamp struct {
	ToDisplay string `json:"toDisplay"`
	Date      string `json:"date"`
	Time      string `json:"time"`
	Timezone  string `json:"timezone"`
}

Timestamp represents information about timestamp. ToDisplay is the field which will be displayed on the UI as the main information. Other details, like timezone might be used in tooltips.

func ToTimestamp

func ToTimestamp(t time.Time) Timestamp

ToTimestamp converts given time into UI Timestamp information.

type UIDagrunDetails added in v0.0.7

type UIDagrunDetails struct {
	RunId    int64          `json:"runId"`
	DagId    string         `json:"dagId"`
	ExecTs   Timestamp      `json:"execTs"`
	Status   string         `json:"status"`
	Duration string         `json:"duration"`
	Tasks    []UIDagrunTask `json:"tasks"`
}

UIDagrunDetails represents details on a single DAG run, including its tasks and their log records.

type UIDagrunList

type UIDagrunList []UIDagrunRow

UIDagrunList is a slice of UiDagrunRow.

type UIDagrunRow

type UIDagrunRow struct {
	RunId            int64     `json:"runId"`
	DagId            string    `json:"dagId"`
	ExecTs           Timestamp `json:"execTs"`
	InsertTs         Timestamp `json:"insertTs"`
	Status           string    `json:"status"`
	StatusUpdateTs   Timestamp `json:"statusUpdateTs"`
	Duration         string    `json:"duration"`
	TaskNum          int       `json:"taskNum"`
	TaskCompletedNum int       `json:"taskCompletedNum"`
}

UIDagrunRow represents information on a single DAG run on the main UI page.

type UIDagrunStats

type UIDagrunStats struct {
	Dagruns               StatusCounts `json:"dagruns"`
	DagrunTasks           StatusCounts `json:"dagrunTasks"`
	DagrunQueueLen        int          `json:"dagrunQueueLen"`
	TaskSchedulerQueueLen int          `json:"taskSchedulerQueueLen"`
	GoroutinesNum         int          `json:"goroutinesNum"`
}

UIDagrunStats is a struct for statistics on DAG runs and related metrics for the main UI page.

type UIDagrunTask added in v0.0.7

type UIDagrunTask struct {
	TaskId        string     `json:"taskId"`
	Retry         int        `json:"retry"`
	InsertTs      Timestamp  `json:"insertTs"`
	TaskNoStarted bool       `json:"taskNotStarted"`
	Status        string     `json:"status"`
	Pos           TaskPos    `json:"taskPosition"`
	Duration      string     `json:"duration"`
	Config        string     `json:"configJson"`
	TaskLogs      UITaskLogs `json:"taskLogs"`
}

UIDagrunTask represents information of single DAG run task, including execution logs.

type UITaskLogRecord added in v0.0.7

type UITaskLogRecord struct {
	InsertTs       Timestamp `json:"insertTs"`
	Level          string    `json:"level"`
	Message        string    `json:"message"`
	AttributesJson string    `json:"attributesJson"`
}

UITaskLogRecord represents task log records with assumed DAG run and task information.

type UITaskLogs added in v0.0.7

type UITaskLogs struct {
	LogRecordsCount int               `json:"logRecordsCount"`
	LoadedRecords   int               `json:"loadedRecords"`
	Records         []UITaskLogRecord `json:"logRecords"`
}

UITaskLogs represents information on DAG run task logs. By default read only fixed number of log records, to limit the request body size and on demand more log records can be loaded in a separate call.

Jump to

Keyboard shortcuts

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