taskcontroller

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 27 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 InitTaskController

func InitTaskController(ctx context.Context) error

func Logger

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

Types

type CancelHandler

type CancelHandler struct{}

CancelHandler ...

func (*CancelHandler) HandleMessage

func (h *CancelHandler) HandleMessage(message *nsq.Message) error

HandleMessage ...

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 ExecHandler

type ExecHandler struct {
	Sender      *nsq.Producer
	TaskPlugins map[config.TaskType]plugins.Initiator
}

ExecHandler ... Sender: sender to send ack/notification TaskPlugins: registered task plugin initiators to initiate specific plugin to execute task

func (*ExecHandler) HandleMessage

func (h *ExecHandler) HandleMessage(message *nsq.Message) error

HandleMessage ... Message handler to handle task execution message

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