dispatch

package
v0.0.0-...-9d58fce Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package dispatch provides a service to dispatch jobs to the runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckJobStatus

func CheckJobStatus(old api.Status, target api.Status) bool

CheckJobStatus checks the ability to transit from old to target status. It's only used for job status transition.

func CheckStepStatus

func CheckStepStatus(old api.Status, target api.Status) bool

CheckStepStatus checks the ability to transit from old to target status. It's only used for step status transition.

Types

type Service

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

func NewService

func NewService(dbClient *db.Client, eventhook *eventhook.Service) *Service

func (*Service) Dispatch

func (s *Service) Dispatch(ctx context.Context, jobs []*db.Job, executions []*db.JobExecution) error

Dispatch dispatches the jobs and updates the job executions. It pushes the jobs to the queue if all the dependencies are completed and success. TODO: proceed dispatch if one job is failed, all the dependent jobs should be skipped.

func (*Service) UpdateJobExecution

func (s *Service) UpdateJobExecution(ctx context.Context, client *db.Client, option *db.UpdateJobExecutionOption) error

UpdateJobExecution updates job execution status and job queue status. It insert a new job queue if the job execution status is queued.

Jump to

Keyboard shortcuts

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