jobservices

package
v3.0.0-...-7ba4d6b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 28 Imported by: 0

Documentation

Overview

Package jobservices handles services necessary WRT handling jobs from SDKs. Nominally this is the entry point for most users, and a job's external interactions outside of pipeline execution.

This includes handling receiving, staging, and provisioning artifacts, and orchestrating external workers, such as for loopback mode.

Execution of jobs is abstracted away to an execute function specified at server construction time.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCancel represents a pipeline cancellation by the user.
	ErrCancel = errors.New("pipeline canceled")
)

Functions

This section is empty.

Types

type Job

type Job struct {
	Pipeline *pipepb.Pipeline

	// Context used to terminate this job.
	RootCtx  context.Context
	CancelFn context.CancelCauseFunc
	// contains filtered or unexported fields
}

Job is an interface to the job services for executing pipelines. It allows the executor to communicate status, messages, and metrics back to callers of the Job Management API.

func (*Job) AddMetricShortIDs

func (j *Job) AddMetricShortIDs(ids *fnpb.MonitoringInfosMetadataResponse)

AddMetricShortIDs populates metric short IDs with their metadata.

func (*Job) ArtifactEndpoint

func (j *Job) ArtifactEndpoint() string

func (*Job) Canceled

func (j *Job) Canceled()

Canceled indicates that the job is canceled.

func (*Job) Canceling

func (j *Job) Canceling()

Canceling indicates that the job is canceling.

func (*Job) ContributeFinalMetrics

func (j *Job) ContributeFinalMetrics(payloads *fnpb.ProcessBundleResponse) []string

ContributeFinalMetrics returns any unknown monitoring short ids.

func (*Job) ContributeTentativeMetrics

func (j *Job) ContributeTentativeMetrics(payloads *fnpb.ProcessBundleProgressResponse) (map[string]int64, []string)

ContributeTentativeMetrics returns the datachannel read index, and any unknown monitoring short ids.

func (*Job) Done

func (j *Job) Done()

Done indicates that the job completed successfully.

func (*Job) Failed

func (j *Job) Failed(err error)

Failed indicates that the job completed unsuccessfully.

func (*Job) JobKey

func (j *Job) JobKey() string

func (*Job) LogValue

func (j *Job) LogValue() slog.Value

func (*Job) PipelineOptions

func (j *Job) PipelineOptions() *structpb.Struct

func (*Job) Running

func (j *Job) Running()

Running indicates that the job is executing.

func (*Job) SendMsg

func (j *Job) SendMsg(msg string)

func (*Job) Start

func (j *Job) Start()

Start indicates that the job is preparing to execute.

func (*Job) String

func (j *Job) String() string

type Server

func NewServer

func NewServer(port int, execute func(*Job)) *Server

NewServer acquires the indicated port.

func (*Server) Cancel

Cancel a Job requested by the CancelJobRequest for jobs not in an already terminal state. Otherwise, returns nil if Job does not exist or the Job's existing state as part of the CancelJobResponse.

func (*Server) Endpoint

func (s *Server) Endpoint() string

func (*Server) GetJobMetrics

GetJobMetrics Fetch metrics for a given job.

func (*Server) GetJobs

GetJobs returns the set of active jobs and associated metadata.

func (*Server) GetMessageStream

func (s *Server) GetMessageStream(req *jobpb.JobMessagesRequest, stream jobpb.JobService_GetMessageStreamServer) error

GetMessageStream subscribes to a stream of state changes and messages from the job. If throughput is high, this may cause losses of messages.

func (*Server) GetPipeline

GetPipeline returns pipeline proto of the requested job id.

func (*Server) GetState

GetState returns the current state of the job with the requested id.

func (*Server) Prepare

func (*Server) Run

func (*Server) Serve

func (s *Server) Serve()

Serve serves on the started listener. Blocks.

func (*Server) Stop

func (s *Server) Stop()

Stop the GRPC server.

Jump to

Keyboard shortcuts

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