worker

package
v0.0.0-...-3f9f090 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

worker执行模块worker负责在本地执行调度模块发送的命令,并将输出信息返回给调度模块。 worker执行时会启动http服务监听8123端口,提供RPC调用接口CmdExecuter.Run()方法。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServer

func ListenAndServer(port string)

启动HTTP服务监控指定端口

Types

type CmdExecuter

type CmdExecuter struct{}

RPC结构 服务端处理部分,接受client端发送的指令。

func (*CmdExecuter) Run

func (this *CmdExecuter) Run(task *Task, reply *Reply) error

Run调用相应的模块,完成对Task的执行 参数task,需要执行的任务信息。 参数reply,任务执行输出的信息。

type Reply

type Reply struct {
	Err    string //错误信息
	Stdout string //标准输出
}

返回的消息

type Task

type Task struct {
	Id          int64             // 任务的ID
	Address     string            // 任务的执行地址
	Name        string            // 任务名称
	JobType     string            // 任务类型
	Cyc         string            //调度周期
	StartSecond int64             //周期内启动时间
	Cmd         string            // 任务执行的命令或脚本、函数名等。
	TimeOut     int64             // 设定超时时间,0表示不做超时限制。单位秒
	Param       []string          // 任务的参数信息
	Attr        map[string]string // 任务的属性信息
	JobId       int64             //所属作业ID
	RelTasks    map[string]*Task  //依赖的任务
	RelTaskCnt  int64             //依赖的任务数量
}

任务信息结构

Jump to

Keyboard shortcuts

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