v2

package
v1.5.33 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyResource

func ApplyResource(req *restful.Request, resp *restful.Response)

ApplyResource handle the http request for applying a new task.

func InitStorage

func InitStorage() (err error)

InitStorage After server init, the instances of manager, store ... etc. should be given into api handler.

func QueryTaskInfo

func QueryTaskInfo(req *restful.Request, resp *restful.Response)

QueryTaskInfo handle the http request for querying a existing task

func ReleaseResource

func ReleaseResource(req *restful.Request, resp *restful.Response)

ReleaseResource handle the http request for releasing a existing task it return immediately after the task saved into database with status finish or failed.

func SendMessage

func SendMessage(req *restful.Request, resp *restful.Response)

SendMessage handle the http request for sending message, task message or project message. task message: taskID should be provided, the message can be a request to collect the task stats data. project message: projectID should be provided, the message can be a project settings query.

func UpdateHeartbeat

func UpdateHeartbeat(req *restful.Request, resp *restful.Response)

UpdateHeartbeat handle the http request for updating task heartbeat.

Types

type HeartBeatType

type HeartBeatType string
const (
	HeartBeatPing HeartBeatType = "ping"
	HeartBeatPong HeartBeatType = "pong"
)

func (HeartBeatType) String

func (h HeartBeatType) String() string

get string data from heartbeat type

type MessageType

type MessageType string
const (
	MessageTask    MessageType = "task"
	MessageProject MessageType = "project"
)

type ParamApply

type ParamApply struct {
	// project_id describe which project this task belongs to
	// project is used to check whitelist and get static settings.
	ProjectID string `json:"project_id"`

	// scene describe the addition unique part of this project.
	// If it is empty, the project_id is the final project_id,
	// else, the project_id should be made of project_id + scene
	Scene string `json:"scene"`

	// build_id is not used during the whole lifetime, just a specific key for query
	BuildID string `json:"build_id"`

	// client_version
	ClientVersion string `json:"client_version"`

	Message   string `json:"message"`
	ClientCPU int    `json:"client_cpu"`

	// extra is a raw string contains the extra configurations for specific engine,
	// it will be parsed in engine handler.
	Extra string `json:"extra"`
}

ParamApply describe the protocol of applying a piece of resources for distribute workers and there will be a TaskBasic to maintain the resource lifetime.

type ParamHeartbeat

type ParamHeartbeat struct {
	TaskID string `json:"task_id"`
	Type   string `json:"type"`
}

ParamHeartbeat contains the UpdateHeartbeat request data

type ParamMessage

type ParamMessage struct {
	Type      MessageType `json:"type"`
	TaskID    string      `json:"task_id"`
	ProjectID string      `json:"project_id"`
	Scene     string      `json:"scene"`
	Extra     string      `json:"extra"`
}

ParamMessage contains the SendMessage request data

type ParamRelease

type ParamRelease struct {
	TaskID  string `json:"task_id"`
	Message string `json:"message"`
	Success bool   `json:"success"`

	// extra is a raw string contains the summary data from client for specific engine,
	// it will be parsed in engine handler.
	Extra string `json:"extra"`
}

ParamRelease contains the ReleaseTask request data

type RespHeartbeat

type RespHeartbeat struct {
	TaskID string `json:"task_id"`
	Type   string `json:"type"`
}

RespHeartbeat contains the return data of UpdateHeartbeat

type RespTaskInfo

type RespTaskInfo struct {
	TaskID      string   `json:"task_id"`
	Status      string   `json:"status"`
	HostList    []string `json:"host_list"`
	QueueNumber int      `json:"queue_number"`
	Message     string   `json:"message"`

	Extra string `json:"extra"`
}

RespTaskInfo contains the return data of Apply and Query

Jump to

Keyboard shortcuts

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