Documentation ¶
Index ¶
- Constants
- func ComputeResultsSummary(j *model.JobWithInfo) string
- func ComputeStateSummary(j model.JobState) string
- func FlattenExecutionStates(jobState model.JobState) []model.ExecutionState
- func GetCompletedExecutionStates(jobState model.JobState) []model.ExecutionState
- func GetExecutionStateTotals(executionStates []model.ExecutionState) map[model.ExecutionStateType]int
- func GetFilteredExecutionStates(jobState model.JobState, filterState model.ExecutionStateType) []model.ExecutionState
- func GetIPFSPublishedStorageSpec(executionID string, job model.Job, storageType model.StorageSourceType, ...) model.StorageSpec
- func IsSafeAnnotation(s string) bool
- func MakeDockerSpec(image, workingdir string, entrypoint, envvar, parameters []string, ...) (model.Spec, error)
- func MakeSpec(opts ...SpecOpt) (model.Spec, error)
- func MakeWasmSpec(entryModule model.StorageSpec, entrypoint string, parameters []string, ...) (model.Spec, error)
- func ParsePublisherString(publisher string) (*models.SpecConfig, error)
- func ParseStorageString(sourceURI, destinationPath string, options map[string]string) (model.StorageSpec, error)
- func PublisherStringToPublisherSpec(destinationURI string, options map[string]interface{}) (model.PublisherSpec, error)
- func RawPublisherStringToPublisherSpec(publisher string) (model.PublisherSpec, error)
- func SafeAnnotationRegex() *regexp.Regexp
- func SafeStringStripper(s string) string
- func ValidateWorkingDir(jobWorkingDir string) error
- func VerifyJob(ctx context.Context, j *model.Job) error
- func VerifyJobCreatePayload(ctx context.Context, jc *model.JobCreatePayload) error
- type CheckStatesFunction
- func WaitDontExceedCount(count int) CheckStatesFunction
- func WaitExecutionsThrowErrors(errorStates []model.ExecutionStateType) CheckStatesFunction
- func WaitForExecutionStates(requiredStateCounts map[model.ExecutionStateType]int) CheckStatesFunction
- func WaitForSuccessfulCompletion() CheckStatesFunction
- func WaitForTerminalStates() CheckStatesFunction
- func WaitForUnsuccessfulCompletion() CheckStatesFunction
- type JobLoader
- type SpecOpt
- func WithAnnotations(annotations ...string) SpecOpt
- func WithDeal(targeting model.TargetingMode, concurrency int) SpecOpt
- func WithDockerEngine(image, workdir string, entrypoint, envvar, parameters []string) SpecOpt
- func WithEngineSpec(e model.EngineSpec) SpecOpt
- func WithInputs(inputs ...model.StorageSpec) SpecOpt
- func WithNetwork(network model.Network, domains []string) SpecOpt
- func WithNodeSelector(selector []model.LabelSelectorRequirement) SpecOpt
- func WithOutputs(outputs ...model.StorageSpec) SpecOpt
- func WithPublisher(p model.PublisherSpec) SpecOpt
- func WithResources(cpu, memory, disk, gpu string) SpecOpt
- func WithTimeout(t int64) SpecOpt
- func WithWasmEngine(entryModule model.StorageSpec, entrypoint string, parameters []string, ...) SpecOpt
- type StateLoader
- type StateResolver
- func (resolver *StateResolver) GetExecutions(ctx context.Context, jobID string) ([]model.ExecutionState, error)
- func (resolver *StateResolver) GetJob(ctx context.Context, id string) (model.Job, error)
- func (resolver *StateResolver) GetJobState(ctx context.Context, id string) (model.JobState, error)
- func (resolver *StateResolver) GetResults(ctx context.Context, jobID string) ([]model.PublishedResult, error)
- func (resolver *StateResolver) SetWaitTime(maxWaitAttempts int, delay time.Duration)
- func (resolver *StateResolver) StateSummary(ctx context.Context, jobID string) (string, error)
- func (resolver *StateResolver) Wait(ctx context.Context, jobID string, ...) error
- func (resolver *StateResolver) WaitUntilComplete(ctx context.Context, jobID string) error
- func (resolver *StateResolver) WaitWithOptions(ctx context.Context, options WaitOptions, ...) error
- type WaitOptions
Constants ¶
const RegexString = "A-Za-z0-9._~!:@,;+-"
Variables ¶
This section is empty.
Functions ¶
func ComputeResultsSummary ¶
func ComputeResultsSummary(j *model.JobWithInfo) string
func ComputeStateSummary ¶
func FlattenExecutionStates ¶
func FlattenExecutionStates(jobState model.JobState) []model.ExecutionState
func GetCompletedExecutionStates ¶ added in v0.3.24
func GetCompletedExecutionStates(jobState model.JobState) []model.ExecutionState
func GetExecutionStateTotals ¶ added in v0.3.24
func GetExecutionStateTotals(executionStates []model.ExecutionState) map[model.ExecutionStateType]int
func GetFilteredExecutionStates ¶ added in v0.3.24
func GetFilteredExecutionStates(jobState model.JobState, filterState model.ExecutionStateType) []model.ExecutionState
func GetIPFSPublishedStorageSpec ¶ added in v0.3.26
func GetIPFSPublishedStorageSpec(executionID string, job model.Job, storageType model.StorageSourceType, cid string) model.StorageSpec
func IsSafeAnnotation ¶
func MakeDockerSpec ¶ added in v1.0.4
func MakeWasmSpec ¶ added in v1.0.4
func ParsePublisherString ¶ added in v0.3.26
func ParsePublisherString(publisher string) (*models.SpecConfig, error)
ParsePublisherString parses a publisher string into a SpecConfig without having to roundtrip through legacy structures.
func ParseStorageString ¶ added in v0.3.26
func PublisherStringToPublisherSpec ¶
func PublisherStringToPublisherSpec(destinationURI string, options map[string]interface{}) (model.PublisherSpec, error)
func RawPublisherStringToPublisherSpec ¶
func RawPublisherStringToPublisherSpec(publisher string) (model.PublisherSpec, error)
RawPublisherStringToPublisherSpec is a legacy function for converting a raw string into a model.PublisherSpec.
func SafeAnnotationRegex ¶
func SafeStringStripper ¶
func ValidateWorkingDir ¶ added in v1.0.4
Function for validating the workdir of a docker command.
func VerifyJobCreatePayload ¶
func VerifyJobCreatePayload(ctx context.Context, jc *model.JobCreatePayload) error
VerifyJobCreatePayload verifies the values in a job creation request are legal.
Types ¶
type CheckStatesFunction ¶
a function that is given a map of nodeid -> job states and will throw an error if anything about that is wrong
func WaitDontExceedCount ¶
func WaitDontExceedCount(count int) CheckStatesFunction
cspell:ignore Dont if there are > X states then error
func WaitExecutionsThrowErrors ¶
func WaitExecutionsThrowErrors(errorStates []model.ExecutionStateType) CheckStatesFunction
error if there are any errors in any of the states
func WaitForExecutionStates ¶
func WaitForExecutionStates(requiredStateCounts map[model.ExecutionStateType]int) CheckStatesFunction
wait for the given number of different states to occur
func WaitForSuccessfulCompletion ¶
func WaitForSuccessfulCompletion() CheckStatesFunction
func WaitForTerminalStates ¶
func WaitForTerminalStates() CheckStatesFunction
WaitForTerminalStates it is possible that a job is in a terminal state, but some executions are still running, such as when one node publishes the result before others. for that reason, we consider a job to be in a terminal state when: - all executions are in a terminal state - the job is in a terminal state to account for possible retries
func WaitForUnsuccessfulCompletion ¶ added in v1.0.4
func WaitForUnsuccessfulCompletion() CheckStatesFunction
type SpecOpt ¶ added in v1.0.4
func WithAnnotations ¶ added in v1.0.4
func WithDeal ¶ added in v1.0.4
func WithDeal(targeting model.TargetingMode, concurrency int) SpecOpt
func WithDockerEngine ¶ added in v1.0.4
func WithEngineSpec ¶ added in v1.0.4
func WithEngineSpec(e model.EngineSpec) SpecOpt
func WithInputs ¶ added in v1.0.4
func WithInputs(inputs ...model.StorageSpec) SpecOpt
func WithNetwork ¶ added in v1.0.4
func WithNodeSelector ¶ added in v1.0.4
func WithNodeSelector(selector []model.LabelSelectorRequirement) SpecOpt
func WithOutputs ¶ added in v1.0.4
func WithOutputs(outputs ...model.StorageSpec) SpecOpt
func WithPublisher ¶ added in v1.0.4
func WithPublisher(p model.PublisherSpec) SpecOpt
func WithResources ¶ added in v1.0.4
func WithTimeout ¶ added in v1.0.4
func WithWasmEngine ¶ added in v1.0.4
func WithWasmEngine( entryModule model.StorageSpec, entrypoint string, parameters []string, envvar map[string]string, importModules []model.StorageSpec, ) SpecOpt
type StateResolver ¶
type StateResolver struct {
// contains filtered or unexported fields
}
func NewStateResolver ¶
func NewStateResolver( jobLoader JobLoader, stateLoader StateLoader, ) *StateResolver
func (*StateResolver) GetExecutions ¶ added in v0.3.24
func (resolver *StateResolver) GetExecutions(ctx context.Context, jobID string) ([]model.ExecutionState, error)
func (*StateResolver) GetJobState ¶
func (*StateResolver) GetResults ¶
func (resolver *StateResolver) GetResults(ctx context.Context, jobID string) ([]model.PublishedResult, error)
func (*StateResolver) SetWaitTime ¶
func (resolver *StateResolver) SetWaitTime(maxWaitAttempts int, delay time.Duration)
func (*StateResolver) StateSummary ¶
func (*StateResolver) Wait ¶
func (resolver *StateResolver) Wait( ctx context.Context, jobID string, checkJobStateFunctions ...CheckStatesFunction, ) error
func (*StateResolver) WaitUntilComplete ¶
func (resolver *StateResolver) WaitUntilComplete(ctx context.Context, jobID string) error
this is an auto wait where we auto calculate how many execution states we expect to see and we use that to pass to WaitForExecutionStates
func (*StateResolver) WaitWithOptions ¶
func (resolver *StateResolver) WaitWithOptions( ctx context.Context, options WaitOptions, checkJobStateFunctions ...CheckStatesFunction, ) error