taskcontroller

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadTestReports

func DownloadTestReports(taskInfo *task.Task, logger *zap.SugaredLogger) ([]*types.TestSuite, error)

func Logger

func Logger(pipelineTask *task.Task) *zap.SugaredLogger

Types

type CancelHandler

type CancelHandler struct{}

func (*CancelHandler) HandleMessage

func (h *CancelHandler) HandleMessage(msg *CancelMessage) error

type CancelMessage

type CancelMessage struct {
	Revoker      string `json:"revoker"`
	PipelineName string `json:"pipeline_name"`
	TaskID       int64  `json:"task_id"`
	ReqID        string `json:"req_id"`
}

CancelMessage ...

type ControllerI added in v1.9.9

type ControllerI interface {
	// Init initializes the controller.
	Init(ctx context.Context) error

	// Stop stops process logics.
	Stop(ctx context.Context) error
}

func NewController added in v1.9.9

func NewController() ControllerI

type ExecHandler

type ExecHandler struct {
	AckID       int
	TaskPlugins map[config.TaskType]plugins.Initiator
}

TaskPlugins: registered task plugin initiators to initiate specific plugin to execute task

func (*ExecHandler) PipelineTaskHandler added in v1.9.9

func (h *ExecHandler) PipelineTaskHandler()

func (*ExecHandler) SendAck

func (h *ExecHandler) SendAck()

SendAck 发送task实时状态信息 无需发送cancel信息

func (*ExecHandler) SendItReport

func (h *ExecHandler) SendItReport()

SendItReport ...

func (*ExecHandler) SendNotification

func (h *ExecHandler) SendNotification()

SendNotification ...

type HookPayload

type HookPayload struct {
	Owner string `json:"owner,omitempty"`
	Repo  string `json:"repo,omitempty"`
	Ref   string `json:"ref,omitempty"`
	IsPr  bool   `json:"is_pr,omitempty"`
}

HookPayload reference. Ref can be a SHA, a branch name, or a tag name.

type Pool

type Pool struct {
	Tasks []*Task
	// contains filtered or unexported fields
}

Pool is a worker group that runs a number of tasks at a configured concurrency.

func NewPool

func NewPool(tasks []*Task, concurrency int) *Pool

NewPool initializes a new pool with the given tasks and at the given concurrency.

func (*Pool) Run

func (p *Pool) Run()

Run runs all work within the pool and blocks until it's finished.

type StatsMessage

type StatsMessage struct {
	Agent            string `json:"agent"`
	MessagesReceived uint64 `json:"messages_received"`
	MessagesFinished uint64 `json:"messages_finished"`
	MessagesRequeued uint64 `json:"messages_requeued"`
	Connections      int    `json:"connections"`
	StartTime        int64  `json:"start_time"`
	UpdateTime       int64  `json:"update_time"`
}

StatsMessage ...

type Task

type Task struct {
	//Status holds task status
	Status config.Status
	// Err holds an error that occurred during a task. Its
	// result is only meaningful after Run has been called
	// for the pool that holds it.
	Err error
	// contains filtered or unexported fields
}

Task encapsulates a taskOperator item that should go in a worker pool

func NewTask

func NewTask(ctx context.Context, taskExecutorFunc taskOperater, plugin plugins.TaskPlugin, subTask map[string]interface{}, pos int, servicename string, log *zap.SugaredLogger) *Task

NewTask initializes a new task based on a given task operator function

func (*Task) Run

func (t *Task) Run(wg *sync.WaitGroup)

Run runs a Task and does appropriate accounting via a given sync.WorkGroup.

Jump to

Keyboard shortcuts

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