task

package
v0.0.0-...-fee78ac Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZERO_TIME = time.Unix(0, 0)

Functions

This section is empty.

Types

type ClusterTaskService

type ClusterTaskService struct {
	// contains filtered or unexported fields
}

func NewClusterTaskService

func NewClusterTaskService() *ClusterTaskService

func (*ClusterTaskService) CancelDag

func (s *ClusterTaskService) CancelDag(dag *task.Dag) error

func (*ClusterTaskService) CreateDagInstanceByTemplate

func (s *ClusterTaskService) CreateDagInstanceByTemplate(template *task.Template, ctx *task.TaskContext) (*task.Dag, error)

func (*ClusterTaskService) CreateLocalTaskInstanceByRemoteTask

func (s *ClusterTaskService) CreateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) (int64, error)

func (*ClusterTaskService) FindLastMaintenanceDag

func (s *ClusterTaskService) FindLastMaintenanceDag() (*task.Dag, error)

func (*ClusterTaskService) FinishDagAsFailed

func (s *ClusterTaskService) FinishDagAsFailed(dag *task.Dag) error

func (*ClusterTaskService) FinishDagAsSucceed

func (s *ClusterTaskService) FinishDagAsSucceed(dag *task.Dag) error

func (*ClusterTaskService) FinishNode

func (s *ClusterTaskService) FinishNode(node *task.Node) error

func (*ClusterTaskService) FinishSubTask

func (s *ClusterTaskService) FinishSubTask(subtask task.ExecutableTask, state int) error

func (*ClusterTaskService) GetAllUnfinishedDagInstance

func (s *ClusterTaskService) GetAllUnfinishedDagInstance() ([]*task.Dag, error)

func (*ClusterTaskService) GetAllUnfinishedSubTasks

func (s *ClusterTaskService) GetAllUnfinishedSubTasks() ([]task.ExecutableTask, error)

func (*ClusterTaskService) GetDagDetail

func (s *ClusterTaskService) GetDagDetail(dagId int64) (dagDetailDTO *task.DagDetailDTO, err error)

func (*ClusterTaskService) GetDagGenericIDBySubTaskId

func (s *ClusterTaskService) GetDagGenericIDBySubTaskId(taskID int64) (dagGenericID string, err error)

func (*ClusterTaskService) GetDagIDBySubTaskId

func (s *ClusterTaskService) GetDagIDBySubTaskId(taskID int64) (dagID int64, err error)

func (*ClusterTaskService) GetDagInstance

func (s *ClusterTaskService) GetDagInstance(dagId int64) (*task.Dag, error)

func (*ClusterTaskService) GetExecuteAgents

func (s *ClusterTaskService) GetExecuteAgents(ctx *task.TaskContext) []meta.AgentInfo

func (*ClusterTaskService) GetLastMaintenanceDag

func (s *ClusterTaskService) GetLastMaintenanceDag() (*task.Dag, error)

func (*ClusterTaskService) GetLocalTaskInstanceByRemoteTaskId

func (s *ClusterTaskService) GetLocalTaskInstanceByRemoteTaskId(remoteTaskId int64) (*sqlite.SubtaskInstance, error)

func (*ClusterTaskService) GetNodeByNodeId

func (s *ClusterTaskService) GetNodeByNodeId(nodeID int64) (*task.Node, error)

func (*ClusterTaskService) GetNodeByStage

func (s *ClusterTaskService) GetNodeByStage(dagID int64, stage int) (*task.Node, error)

func (*ClusterTaskService) GetNodeBySubTask

func (s *ClusterTaskService) GetNodeBySubTask(taskID int64) (*task.Node, error)

func (*ClusterTaskService) GetNodes

func (s *ClusterTaskService) GetNodes(dag *task.Dag) ([]*task.Node, error)

func (*ClusterTaskService) GetRemoteTaskIdByLocalTaskId

func (s *ClusterTaskService) GetRemoteTaskIdByLocalTaskId(localTaskId int64) (int64, error)

func (*ClusterTaskService) GetSubTaskByTaskID

func (s *ClusterTaskService) GetSubTaskByTaskID(taskID int64) (task.ExecutableTask, error)

func (*ClusterTaskService) GetSubTaskLogsByTaskID

func (s *ClusterTaskService) GetSubTaskLogsByTaskID(taskID int64) (subTaskLogs []string, err error)

func (*ClusterTaskService) GetSubTasks

func (s *ClusterTaskService) GetSubTasks(node *task.Node) ([]task.ExecutableTask, error)

func (*ClusterTaskService) GetTaskMappingByRemoteTaskId

func (s *ClusterTaskService) GetTaskMappingByRemoteTaskId(remoteTaskId int64) (*sqlite.TaskMapping, error)

func (*ClusterTaskService) GetUnSyncTaskMappingByTime

func (s *ClusterTaskService) GetUnSyncTaskMappingByTime(lastTime time.Time, limit int) (taskMappings []sqlite.TaskMapping, err error)

func (*ClusterTaskService) GetUnfinishedDagInstance

func (s *ClusterTaskService) GetUnfinishedDagInstance() (*task.Dag, error)

func (*ClusterTaskService) IsRetryTask

func (s *ClusterTaskService) IsRetryTask(localTaskId int64) (isRetry bool, err error)

func (*ClusterTaskService) PassDag

func (s *ClusterTaskService) PassDag(dag *task.Dag) error

func (*ClusterTaskService) SetDagRetryAndReady

func (s *ClusterTaskService) SetDagRetryAndReady(dag *task.Dag) error

func (*ClusterTaskService) SetDagRollback

func (s *ClusterTaskService) SetDagRollback(dag *task.Dag) error

func (*ClusterTaskService) SetSubTaskFailed

func (s *ClusterTaskService) SetSubTaskFailed(subtask task.ExecutableTask, logContent string) error

func (*ClusterTaskService) SetSubTaskReady

func (s *ClusterTaskService) SetSubTaskReady(subtask task.ExecutableTask, operator int) error

func (*ClusterTaskService) SetTaskMappingSync

func (s *ClusterTaskService) SetTaskMappingSync(remoteTaskId int64, executeTimes int) error

func (*ClusterTaskService) StartDag

func (s *ClusterTaskService) StartDag(dag *task.Dag) error

func (*ClusterTaskService) StartNode

func (s *ClusterTaskService) StartNode(node *task.Node) error

func (*ClusterTaskService) StartSubTask

func (s *ClusterTaskService) StartSubTask(subtask task.ExecutableTask) error

func (*ClusterTaskService) UpdateDagStage

func (s *ClusterTaskService) UpdateDagStage(dag *task.Dag, nextSage int) error

func (*ClusterTaskService) UpdateLocalTaskInstanceByRemoteTask

func (s *ClusterTaskService) UpdateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) error

type DagServiceInterface

type DagServiceInterface interface {
	// Create dag, node, subTasks based on template and context
	CreateDagInstanceByTemplate(*task.Template, *task.TaskContext) (*task.Dag, error)

	GetDagInstance(int64) (*task.Dag, error)

	GetUnfinishedDagInstance() (*task.Dag, error)

	GetAllUnfinishedDagInstance() ([]*task.Dag, error)

	GetLastMaintenanceDag() (*task.Dag, error)

	// Advance dag from ready to running
	StartDag(*task.Dag) error

	// Advance dag to next stage
	UpdateDagStage(*task.Dag, int) error

	// Advance dag from running to failed
	FinishDagAsFailed(*task.Dag) error

	// Advance dag from running to succeed
	FinishDagAsSucceed(*task.Dag) error

	CancelDag(*task.Dag) error

	PassDag(*task.Dag) error

	SetDagRollback(*task.Dag) error

	SetDagRetryAndReady(*task.Dag) error
}

type LocalTaskService

type LocalTaskService struct {
	// contains filtered or unexported fields
}

func NewLocalTaskService

func NewLocalTaskService() *LocalTaskService

func (*LocalTaskService) CancelDag

func (s *LocalTaskService) CancelDag(dag *task.Dag) error

func (*LocalTaskService) CreateDagInstanceByTemplate

func (s *LocalTaskService) CreateDagInstanceByTemplate(template *task.Template, ctx *task.TaskContext) (*task.Dag, error)

func (*LocalTaskService) CreateLocalTaskInstanceByRemoteTask

func (s *LocalTaskService) CreateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) (int64, error)

func (*LocalTaskService) DeleteRemoteTask

func (s *LocalTaskService) DeleteRemoteTask() error

func (*LocalTaskService) FindLastMaintenanceDag

func (s *LocalTaskService) FindLastMaintenanceDag() (*task.Dag, error)

func (*LocalTaskService) FinishDagAsFailed

func (s *LocalTaskService) FinishDagAsFailed(dag *task.Dag) error

func (*LocalTaskService) FinishDagAsSucceed

func (s *LocalTaskService) FinishDagAsSucceed(dag *task.Dag) error

func (*LocalTaskService) FinishNode

func (s *LocalTaskService) FinishNode(node *task.Node) error

func (*LocalTaskService) FinishSubTask

func (s *LocalTaskService) FinishSubTask(subtask task.ExecutableTask, state int) error

func (*LocalTaskService) GetAllUnfinishedDagInstance

func (s *LocalTaskService) GetAllUnfinishedDagInstance() ([]*task.Dag, error)

func (*LocalTaskService) GetAllUnfinishedSubTasks

func (s *LocalTaskService) GetAllUnfinishedSubTasks() ([]task.ExecutableTask, error)

func (*LocalTaskService) GetDagDetail

func (s *LocalTaskService) GetDagDetail(dagId int64) (dagDetailDTO *task.DagDetailDTO, err error)

func (*LocalTaskService) GetDagGenericIDBySubTaskId

func (s *LocalTaskService) GetDagGenericIDBySubTaskId(taskID int64) (dagGenericID string, err error)

func (*LocalTaskService) GetDagIDBySubTaskId

func (s *LocalTaskService) GetDagIDBySubTaskId(taskID int64) (dagID int64, err error)

func (*LocalTaskService) GetDagInstance

func (s *LocalTaskService) GetDagInstance(dagId int64) (*task.Dag, error)

func (*LocalTaskService) GetExecuteAgents

func (s *LocalTaskService) GetExecuteAgents(ctx *task.TaskContext) []meta.AgentInfo

func (*LocalTaskService) GetLastMaintenanceDag

func (s *LocalTaskService) GetLastMaintenanceDag() (*task.Dag, error)

func (*LocalTaskService) GetLocalTaskInstanceByRemoteTaskId

func (s *LocalTaskService) GetLocalTaskInstanceByRemoteTaskId(remoteTaskId int64) (*sqlite.SubtaskInstance, error)

func (*LocalTaskService) GetNodeByNodeId

func (s *LocalTaskService) GetNodeByNodeId(nodeID int64) (*task.Node, error)

func (*LocalTaskService) GetNodeByStage

func (s *LocalTaskService) GetNodeByStage(dagID int64, stage int) (*task.Node, error)

func (*LocalTaskService) GetNodeBySubTask

func (s *LocalTaskService) GetNodeBySubTask(taskID int64) (*task.Node, error)

func (*LocalTaskService) GetNodeOperatorBySubTaskId

func (s *LocalTaskService) GetNodeOperatorBySubTaskId(taskID int64) (int, error)

func (*LocalTaskService) GetNodes

func (s *LocalTaskService) GetNodes(dag *task.Dag) ([]*task.Node, error)

func (*LocalTaskService) GetRemoteTaskIdByLocalTaskId

func (s *LocalTaskService) GetRemoteTaskIdByLocalTaskId(localTaskId int64) (int64, error)

func (*LocalTaskService) GetSubTaskByTaskID

func (s *LocalTaskService) GetSubTaskByTaskID(taskID int64) (task.ExecutableTask, error)

func (*LocalTaskService) GetSubTaskLogsByTaskID

func (s *LocalTaskService) GetSubTaskLogsByTaskID(taskID int64) (subTaskLogs []string, err error)

func (*LocalTaskService) GetSubTasks

func (s *LocalTaskService) GetSubTasks(node *task.Node) ([]task.ExecutableTask, error)

func (*LocalTaskService) GetTaskMappingByRemoteTaskId

func (s *LocalTaskService) GetTaskMappingByRemoteTaskId(remoteTaskId int64) (*sqlite.TaskMapping, error)

func (*LocalTaskService) GetUnSyncTaskMappingByTime

func (s *LocalTaskService) GetUnSyncTaskMappingByTime(lastTime time.Time, limit int) (taskMappings []sqlite.TaskMapping, err error)

func (*LocalTaskService) GetUnfinishedDagInstance

func (s *LocalTaskService) GetUnfinishedDagInstance() (*task.Dag, error)

func (*LocalTaskService) IsRetryTask

func (s *LocalTaskService) IsRetryTask(localTaskId int64) (isRetry bool, err error)

func (*LocalTaskService) PassDag

func (s *LocalTaskService) PassDag(dag *task.Dag) error

func (*LocalTaskService) SetDagRetryAndReady

func (s *LocalTaskService) SetDagRetryAndReady(dag *task.Dag) error

func (*LocalTaskService) SetDagRollback

func (s *LocalTaskService) SetDagRollback(dag *task.Dag) error

func (*LocalTaskService) SetSubTaskFailed

func (s *LocalTaskService) SetSubTaskFailed(subtask task.ExecutableTask, logContent string) error

func (*LocalTaskService) SetSubTaskReady

func (s *LocalTaskService) SetSubTaskReady(subtask task.ExecutableTask, operator int) error

func (*LocalTaskService) SetTaskMappingSync

func (s *LocalTaskService) SetTaskMappingSync(remoteTaskId int64, executeTimes int) error

func (*LocalTaskService) StartDag

func (s *LocalTaskService) StartDag(dag *task.Dag) error

func (*LocalTaskService) StartNode

func (s *LocalTaskService) StartNode(node *task.Node) error

func (*LocalTaskService) StartSubTask

func (s *LocalTaskService) StartSubTask(subtask task.ExecutableTask) error

func (*LocalTaskService) UpdateDagStage

func (s *LocalTaskService) UpdateDagStage(dag *task.Dag, nextSage int) error

func (*LocalTaskService) UpdateLocalTaskInstanceByRemoteTask

func (s *LocalTaskService) UpdateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) error

type NodeServiceInterface

type NodeServiceInterface interface {
	GetNodes(*task.Dag) ([]*task.Node, error)

	GetNodeByNodeId(int64) (*task.Node, error)

	GetNodeByStage(int64, int) (*task.Node, error)

	// Advance node from pending to running
	StartNode(*task.Node) error

	// Advance node from running to succeed/failed
	FinishNode(*task.Node) error
}

type StatusMaintainerInterface

type StatusMaintainerInterface interface {
	StartMaintenance(*gorm.DB, task.Maintainer) error
	UpdateMaintenanceTask(*gorm.DB, *task.Dag) error
	StopMaintenance(*gorm.DB, task.Maintainer) error
	IsRunning() (bool, error)
	IsInited() (bool, error)
}

type SubTaskLogService

type SubTaskLogService struct {
	// contains filtered or unexported fields
}

func (*SubTaskLogService) CancelDag

func (s *SubTaskLogService) CancelDag(dag *task.Dag) error

func (*SubTaskLogService) CreateDagInstanceByTemplate

func (s *SubTaskLogService) CreateDagInstanceByTemplate(template *task.Template, ctx *task.TaskContext) (*task.Dag, error)

func (*SubTaskLogService) CreateLocalTaskInstanceByRemoteTask

func (s *SubTaskLogService) CreateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) (int64, error)

func (*SubTaskLogService) FindLastMaintenanceDag

func (s *SubTaskLogService) FindLastMaintenanceDag() (*task.Dag, error)

func (*SubTaskLogService) FinishDagAsFailed

func (s *SubTaskLogService) FinishDagAsFailed(dag *task.Dag) error

func (*SubTaskLogService) FinishDagAsSucceed

func (s *SubTaskLogService) FinishDagAsSucceed(dag *task.Dag) error

func (*SubTaskLogService) FinishNode

func (s *SubTaskLogService) FinishNode(node *task.Node) error

func (*SubTaskLogService) FinishSubTask

func (s *SubTaskLogService) FinishSubTask(subtask task.ExecutableTask, state int) error

func (*SubTaskLogService) GetAllUnfinishedDagInstance

func (s *SubTaskLogService) GetAllUnfinishedDagInstance() ([]*task.Dag, error)

func (*SubTaskLogService) GetAllUnfinishedSubTasks

func (s *SubTaskLogService) GetAllUnfinishedSubTasks() ([]task.ExecutableTask, error)

func (*SubTaskLogService) GetDagDetail

func (s *SubTaskLogService) GetDagDetail(dagId int64) (dagDetailDTO *task.DagDetailDTO, err error)

func (*SubTaskLogService) GetDagGenericIDBySubTaskId

func (s *SubTaskLogService) GetDagGenericIDBySubTaskId(taskID int64) (dagGenericID string, err error)

func (*SubTaskLogService) GetDagIDBySubTaskId

func (s *SubTaskLogService) GetDagIDBySubTaskId(taskID int64) (dagID int64, err error)

func (*SubTaskLogService) GetDagInstance

func (s *SubTaskLogService) GetDagInstance(dagId int64) (*task.Dag, error)

func (*SubTaskLogService) GetExecuteAgents

func (s *SubTaskLogService) GetExecuteAgents(ctx *task.TaskContext) []meta.AgentInfo

func (*SubTaskLogService) GetLastMaintenanceDag

func (s *SubTaskLogService) GetLastMaintenanceDag() (*task.Dag, error)

func (*SubTaskLogService) GetLocalTaskInstanceByRemoteTaskId

func (s *SubTaskLogService) GetLocalTaskInstanceByRemoteTaskId(remoteTaskId int64) (*sqlite.SubtaskInstance, error)

func (*SubTaskLogService) GetNodeByNodeId

func (s *SubTaskLogService) GetNodeByNodeId(nodeID int64) (*task.Node, error)

func (*SubTaskLogService) GetNodeByStage

func (s *SubTaskLogService) GetNodeByStage(dagID int64, stage int) (*task.Node, error)

func (*SubTaskLogService) GetNodeBySubTask

func (s *SubTaskLogService) GetNodeBySubTask(taskID int64) (*task.Node, error)

func (*SubTaskLogService) GetNodes

func (s *SubTaskLogService) GetNodes(dag *task.Dag) ([]*task.Node, error)

func (*SubTaskLogService) GetRemoteTaskIdByLocalTaskId

func (s *SubTaskLogService) GetRemoteTaskIdByLocalTaskId(localTaskId int64) (int64, error)

func (*SubTaskLogService) GetSubTaskByTaskID

func (s *SubTaskLogService) GetSubTaskByTaskID(taskID int64) (task.ExecutableTask, error)

func (*SubTaskLogService) GetSubTaskLogsByTaskID

func (s *SubTaskLogService) GetSubTaskLogsByTaskID(taskID int64) (subTaskLogs []string, err error)

func (*SubTaskLogService) GetSubTasks

func (s *SubTaskLogService) GetSubTasks(node *task.Node) ([]task.ExecutableTask, error)

func (*SubTaskLogService) GetTaskMappingByRemoteTaskId

func (s *SubTaskLogService) GetTaskMappingByRemoteTaskId(remoteTaskId int64) (*sqlite.TaskMapping, error)

func (*SubTaskLogService) GetUnSyncSubTaskLogById

func (s *SubTaskLogService) GetUnSyncSubTaskLogById(id int64, limit int) (subTaskLogs []sqlite.SubTaskLog, err error)

func (*SubTaskLogService) GetUnSyncTaskMappingByTime

func (s *SubTaskLogService) GetUnSyncTaskMappingByTime(lastTime time.Time, limit int) (taskMappings []sqlite.TaskMapping, err error)

func (*SubTaskLogService) GetUnfinishedDagInstance

func (s *SubTaskLogService) GetUnfinishedDagInstance() (*task.Dag, error)

func (*SubTaskLogService) InsertLocal

func (s *SubTaskLogService) InsertLocal(subTaskLog task.TaskExecuteLogDTO) (err error)

func (*SubTaskLogService) InsertLocalToRemote

func (s *SubTaskLogService) InsertLocalToRemote(subTaskLog task.TaskExecuteLogDTO) error

func (*SubTaskLogService) InsertRemote

func (s *SubTaskLogService) InsertRemote(subTaskLog task.TaskExecuteLogDTO) (err error)

func (*SubTaskLogService) IsRetryTask

func (s *SubTaskLogService) IsRetryTask(localTaskId int64) (isRetry bool, err error)

func (*SubTaskLogService) PassDag

func (s *SubTaskLogService) PassDag(dag *task.Dag) error

func (*SubTaskLogService) SetDagRetryAndReady

func (s *SubTaskLogService) SetDagRetryAndReady(dag *task.Dag) error

func (*SubTaskLogService) SetDagRollback

func (s *SubTaskLogService) SetDagRollback(dag *task.Dag) error

func (*SubTaskLogService) SetLocalIsSync

func (s *SubTaskLogService) SetLocalIsSync(subTaskLog *sqlite.SubTaskLog) error

func (*SubTaskLogService) SetSubTaskFailed

func (s *SubTaskLogService) SetSubTaskFailed(subtask task.ExecutableTask, logContent string) error

func (*SubTaskLogService) SetSubTaskReady

func (s *SubTaskLogService) SetSubTaskReady(subtask task.ExecutableTask, operator int) error

func (*SubTaskLogService) SetTaskMappingSync

func (s *SubTaskLogService) SetTaskMappingSync(remoteTaskId int64, executeTimes int) error

func (*SubTaskLogService) StartDag

func (s *SubTaskLogService) StartDag(dag *task.Dag) error

func (*SubTaskLogService) StartNode

func (s *SubTaskLogService) StartNode(node *task.Node) error

func (*SubTaskLogService) StartSubTask

func (s *SubTaskLogService) StartSubTask(subtask task.ExecutableTask) error

func (*SubTaskLogService) UpdateDagStage

func (s *SubTaskLogService) UpdateDagStage(dag *task.Dag, nextSage int) error

func (*SubTaskLogService) UpdateLocalTaskInstanceByRemoteTask

func (s *SubTaskLogService) UpdateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) error

type SubTaskLogServiceInterface

type SubTaskLogServiceInterface interface {
	GetSubTaskLogsByTaskID(int64) ([]string, error)
}

type SubTaskServiceInterface

type SubTaskServiceInterface interface {
	CreateLocalTaskInstanceByRemoteTask(*task.RemoteTask) (int64, error)

	GetLocalTaskInstanceByRemoteTaskId(int64) (*sqlite.SubtaskInstance, error)

	GetSubTasks(*task.Node) ([]task.ExecutableTask, error)

	GetSubTaskByTaskID(int64) (task.ExecutableTask, error)

	GetAllUnfinishedSubTasks() ([]task.ExecutableTask, error)

	GetTaskMappingByRemoteTaskId(int64) (*sqlite.TaskMapping, error)

	GetUnSyncTaskMappingByTime(time.Time, int) ([]sqlite.TaskMapping, error)

	GetRemoteTaskIdByLocalTaskId(int64) (int64, error)

	// Advance subTask from ready to running
	StartSubTask(task.ExecutableTask) error

	// Advance subTask from running to succeed/failed
	FinishSubTask(task.ExecutableTask, int) error

	// Advance subTask to ready
	SetSubTaskReady(task.ExecutableTask, int) error

	// Advance subTask from running to failed
	SetSubTaskFailed(task.ExecutableTask, string) error

	// Advance IsSync to true
	SetTaskMappingSync(int64, int) error

	UpdateLocalTaskInstanceByRemoteTask(remoteTask *task.RemoteTask) error
}

type TaskServiceInterface

type TaskServiceInterface interface {
	DagServiceInterface
	NodeServiceInterface
	SubTaskServiceInterface
	SubTaskLogServiceInterface
	StatusMaintainerInterface

	// Get the agents that executes the task from TaskContext
	GetExecuteAgents(*task.TaskContext) []meta.AgentInfo
}

Jump to

Keyboard shortcuts

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