job

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package job implements functionality releated to Phobos jobs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelJobInput

type CancelJobInput struct {
	Version *int
	ID      string
	Force   bool
}

CancelJobInput includes options for canceling a job

type CancellationEvent

type CancellationEvent struct {
	Job *models.Job
}

CancellationEvent represents a job cancellation event

type CancellationSubscriptionsOptions

type CancellationSubscriptionsOptions struct {
	JobID string
}

CancellationSubscriptionsOptions includes options for setting up a cancellation event subscription

type ClaimJobResponse

type ClaimJobResponse struct {
	Job   *models.Job
	Token string
}

ClaimJobResponse is returned when a agent claims a Job

type Event

type Event struct {
	Job    *models.Job
	Action string
}

Event is a job event

type GetJobsInput

type GetJobsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.JobSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// PipelineID filters the jobs by the specified pipeline.
	PipelineID *string
	// PipelineTaskPath filters the jobs by the specified pipeline task path.
	PipelineTaskPath *string
	// ProjectID filters the jobs by the specified project.
	ProjectID *string
	// AgentID filters the jobs by the specified agent ID
	AgentID *string
	// JobStatuses filters the jobs by their status.
	JobStatuses []models.JobStatus
}

GetJobsInput is the input for querying a list of jobs

type LogEvent

type LogEvent struct {
	Size      int
	Completed bool
}

LogEvent represents a log stream event

type LogStreamEventSubscriptionOptions

type LogStreamEventSubscriptionOptions struct {
	LastSeenLogSize *int
	JobID           string
}

LogStreamEventSubscriptionOptions includes options for setting up a log event subscription

type Service

type Service interface {
	ClaimJob(ctx context.Context, agentID string) (*ClaimJobResponse, error)
	GetJobByPRN(ctx context.Context, prn string) (*models.Job, error)
	GetJobByID(ctx context.Context, jobID string) (*models.Job, error)
	SetJobStatus(ctx context.Context, jobID string, status models.JobStatus) (*models.Job, error)
	GetJobsByIDs(ctx context.Context, idList []string) ([]models.Job, error)
	GetJobs(ctx context.Context, input *GetJobsInput) (*db.JobsResult, error)
	SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error)
	WriteLogs(ctx context.Context, jobID string, startOffset int, logs []byte) (int, error)
	ReadLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error)
	SubscribeToLogStreamEvents(ctx context.Context, options *LogStreamEventSubscriptionOptions) (<-chan *logstream.LogEvent, error)
	GetLogStreamsByJobIDs(ctx context.Context, idList []string) ([]models.LogStream, error)
	SubscribeToJobs(ctx context.Context, options *SubscribeToJobsInput) (<-chan *Event, error)
	CancelJob(ctx context.Context, input *CancelJobInput) (*models.Job, error)
}

Service implements all organization related functionality

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	idp *auth.IdentityProvider,
	logStreamManager logstream.Manager,
	eventManager *events.EventManager,
	pipelineUpdater pipeline.Updater,
) Service

NewService returns an instance of Service

type SubscribeToJobsInput

type SubscribeToJobsInput struct {
	ProjectID  *string
	AgentID    *string
	PipelineID *string
}

SubscribeToJobsInput is the input for subscribing to jobs

Jump to

Keyboard shortcuts

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