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 ¶
- Variables
- type Job
- func (j *Job) AddMetricShortIDs(ids *fnpb.MonitoringInfosMetadataResponse)
- func (j *Job) ArtifactEndpoint() string
- func (j *Job) Canceled()
- func (j *Job) Canceling()
- func (j *Job) ContributeFinalMetrics(payloads *fnpb.ProcessBundleResponse) []string
- func (j *Job) ContributeTentativeMetrics(payloads *fnpb.ProcessBundleProgressResponse) (map[string]int64, []string)
- func (j *Job) Done()
- func (j *Job) Failed(err error)
- func (j *Job) JobKey() string
- func (j *Job) LogValue() slog.Value
- func (j *Job) PipelineOptions() *structpb.Struct
- func (j *Job) Running()
- func (j *Job) SendMsg(msg string)
- func (j *Job) Start()
- func (j *Job) String() string
- type Server
- func (s *Server) Cancel(_ context.Context, req *jobpb.CancelJobRequest) (*jobpb.CancelJobResponse, error)
- func (s *Server) DescribePipelineOptions(context.Context, *jobpb.DescribePipelineOptionsRequest) (*jobpb.DescribePipelineOptionsResponse, error)
- func (s *Server) Endpoint() string
- func (s *Server) GetArtifact(req *jobpb.GetArtifactRequest, ...) error
- func (s *Server) GetJobMetrics(ctx context.Context, req *jobpb.GetJobMetricsRequest) (*jobpb.GetJobMetricsResponse, error)
- func (s *Server) GetJobs(context.Context, *jobpb.GetJobsRequest) (*jobpb.GetJobsResponse, error)
- func (s *Server) GetMessageStream(req *jobpb.JobMessagesRequest, stream jobpb.JobService_GetMessageStreamServer) error
- func (s *Server) GetPipeline(_ context.Context, req *jobpb.GetJobPipelineRequest) (*jobpb.GetJobPipelineResponse, error)
- func (s *Server) GetState(_ context.Context, req *jobpb.GetJobStateRequest) (*jobpb.JobStateEvent, error)
- func (s *Server) GetStateStream(req *jobpb.GetJobStateRequest, stream jobpb.JobService_GetStateStreamServer) error
- func (s *Server) Prepare(ctx context.Context, req *jobpb.PrepareJobRequest) (*jobpb.PrepareJobResponse, error)
- func (s *Server) ResolveArtifacts(_ context.Context, req *jobpb.ResolveArtifactsRequest) (*jobpb.ResolveArtifactsResponse, error)
- func (s *Server) ReverseArtifactRetrievalService(stream jobpb.ArtifactStagingService_ReverseArtifactRetrievalServiceServer) error
- func (s *Server) Run(ctx context.Context, req *jobpb.RunJobRequest) (*jobpb.RunJobResponse, error)
- func (s *Server) Serve()
- func (s *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
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 ¶ added in v2.48.0
func (j *Job) AddMetricShortIDs(ids *fnpb.MonitoringInfosMetadataResponse)
AddMetricShortIDs populates metric short IDs with their metadata.
func (*Job) ArtifactEndpoint ¶ added in v2.51.0
func (*Job) Canceled ¶ added in v2.55.0
func (j *Job) Canceled()
Canceled indicates that the job is canceled.
func (*Job) Canceling ¶ added in v2.55.0
func (j *Job) Canceling()
Canceling indicates that the job is canceling.
func (*Job) ContributeFinalMetrics ¶ added in v2.48.0
func (j *Job) ContributeFinalMetrics(payloads *fnpb.ProcessBundleResponse) []string
ContributeFinalMetrics returns any unknown monitoring short ids.
func (*Job) ContributeTentativeMetrics ¶ added in v2.48.0
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) PipelineOptions ¶ added in v2.51.0
type Server ¶
type Server struct { jobpb.UnimplementedJobServiceServer jobpb.UnimplementedArtifactStagingServiceServer jobpb.UnimplementedArtifactRetrievalServiceServer fnpb.UnimplementedProvisionServiceServer // contains filtered or unexported fields }
func (*Server) Cancel ¶ added in v2.55.0
func (s *Server) Cancel(_ context.Context, req *jobpb.CancelJobRequest) (*jobpb.CancelJobResponse, error)
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) DescribePipelineOptions ¶ added in v2.58.0
func (s *Server) DescribePipelineOptions(context.Context, *jobpb.DescribePipelineOptionsRequest) (*jobpb.DescribePipelineOptionsResponse, error)
DescribePipelineOptions is a no-op since it's unclear how it is to function. Apparently only implemented in the Python SDK.
func (*Server) GetArtifact ¶ added in v2.51.0
func (s *Server) GetArtifact(req *jobpb.GetArtifactRequest, stream jobpb.ArtifactRetrievalService_GetArtifactServer) error
func (*Server) GetJobMetrics ¶
func (s *Server) GetJobMetrics(ctx context.Context, req *jobpb.GetJobMetricsRequest) (*jobpb.GetJobMetricsResponse, error)
GetJobMetrics Fetch metrics for a given job.
func (*Server) GetJobs ¶ added in v2.49.0
func (s *Server) GetJobs(context.Context, *jobpb.GetJobsRequest) (*jobpb.GetJobsResponse, error)
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 ¶ added in v2.49.0
func (s *Server) GetPipeline(_ context.Context, req *jobpb.GetJobPipelineRequest) (*jobpb.GetJobPipelineResponse, error)
GetPipeline returns pipeline proto of the requested job id.
func (*Server) GetState ¶ added in v2.49.0
func (s *Server) GetState(_ context.Context, req *jobpb.GetJobStateRequest) (*jobpb.JobStateEvent, error)
GetState returns the current state of the job with the requested id.
func (*Server) GetStateStream ¶ added in v2.58.0
func (s *Server) GetStateStream(req *jobpb.GetJobStateRequest, stream jobpb.JobService_GetStateStreamServer) error
GetStateStream returns the job state as it changes.
func (*Server) Prepare ¶
func (s *Server) Prepare(ctx context.Context, req *jobpb.PrepareJobRequest) (*jobpb.PrepareJobResponse, error)
func (*Server) ResolveArtifacts ¶ added in v2.51.0
func (s *Server) ResolveArtifacts(_ context.Context, req *jobpb.ResolveArtifactsRequest) (*jobpb.ResolveArtifactsResponse, error)
func (*Server) ReverseArtifactRetrievalService ¶
func (s *Server) ReverseArtifactRetrievalService(stream jobpb.ArtifactStagingService_ReverseArtifactRetrievalServiceServer) error
func (*Server) Run ¶
func (s *Server) Run(ctx context.Context, req *jobpb.RunJobRequest) (*jobpb.RunJobResponse, error)