Documentation ¶
Index ¶
- Constants
- func ComputeResultsSummary(j *model.JobWithInfo) string
- func ComputeStateSummary(j model.JobState) string
- func ComputeVerifiedSummary(j *model.JobWithInfo) string
- func ConstructDockerJob(ctx context.Context, a model.APIVersion, e model.Engine, v model.Verifier, ...) (*model.Job, error)
- func ConstructLanguageJob(ctx context.Context, inputs []model.StorageSpec, outputVolumes []string, ...) (*model.Job, error)
- func CountVerifiedExecutionStates(jobState model.JobState) int
- func FlattenExecutionStates(jobState model.JobState) []model.ExecutionState
- func GetCompletedExecutionStates(jobState model.JobState) []model.ExecutionState
- func GetCompletedVerifiedExecutionStates(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 GetJobConcurrency(j model.Job) int
- func IsSafeAnnotation(s string) bool
- func ParseNodeSelector(nodeSelector string) ([]model.LabelSelectorRequirement, error)
- func ParsePublisherString(destinationURI string, options map[string]interface{}) (model.PublisherSpec, error)
- func ParseStorageString(sourceURI, destinationPath string, options map[string]string) (model.StorageSpec, error)
- func SafeAnnotationRegex() *regexp.Regexp
- func SafeStringStripper(s string) string
- func ShortID(id string) string
- 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
- type ExecutionStateChecker
- type JobLoader
- type StateLoader
- type StateResolver
- func (resolver *StateResolver) CheckExecutionStates(ctx context.Context, job model.Job, ...) (bool, error)
- 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) ResultSummary(ctx context.Context, jobID string) (string, error)
- func (resolver *StateResolver) SetWaitTime(maxWaitAttempts int, delay time.Duration)
- func (resolver *StateResolver) StateSummary(ctx context.Context, jobID string) (string, error)
- func (resolver *StateResolver) VerifiedSummary(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 ComputeVerifiedSummary ¶
func ComputeVerifiedSummary(j *model.JobWithInfo) string
func ConstructDockerJob ¶
func ConstructDockerJob( ctx context.Context, a model.APIVersion, e model.Engine, v model.Verifier, p model.PublisherSpec, cpu, memory, gpu string, network model.Network, domains []string, inputs []model.StorageSpec, outputVolumes []string, env []string, entrypoint []string, image string, concurrency int, confidence int, minBids int, timeout float64, annotations []string, nodeSelector string, workingDir string, ) (*model.Job, error)
these are util methods for the CLI to pass in the collection of CLI args as strings and have a Job struct returned
func ConstructLanguageJob ¶
func ConstructLanguageJob( ctx context.Context, inputs []model.StorageSpec, outputVolumes []string, concurrency int, confidence int, minBids int, timeout float64, language string, languageVersion string, command string, programPath string, requirementsPath string, deterministic bool, annotations []string, ) (*model.Job, error)
func CountVerifiedExecutionStates ¶ added in v0.3.24
func FlattenExecutionStates ¶
func FlattenExecutionStates(jobState model.JobState) []model.ExecutionState
func GetCompletedExecutionStates ¶ added in v0.3.24
func GetCompletedExecutionStates(jobState model.JobState) []model.ExecutionState
func GetCompletedVerifiedExecutionStates ¶ added in v0.3.24
func GetCompletedVerifiedExecutionStates(jobState model.JobState) []model.ExecutionState
return only execution states that are both complete and verified
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 GetJobConcurrency ¶
func IsSafeAnnotation ¶
func ParseNodeSelector ¶
func ParseNodeSelector(nodeSelector string) ([]model.LabelSelectorRequirement, error)
func ParsePublisherString ¶ added in v0.3.26
func ParsePublisherString(destinationURI string, options map[string]interface{}) (model.PublisherSpec, error)
func ParseStorageString ¶ added in v0.3.26
func SafeAnnotationRegex ¶
func SafeStringStripper ¶
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
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, or when confidence factor is lower than concurrency. 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
type ExecutionStateChecker ¶ added in v0.3.24
type ExecutionStateChecker func( executionStates []model.ExecutionState, concurrency int, ) (bool, error)
type StateLoader ¶
func NewNoopStateLoader ¶ added in v0.3.26
func NewNoopStateLoader() StateLoader
type StateResolver ¶
type StateResolver struct {
// contains filtered or unexported fields
}
func NewStateResolver ¶
func NewStateResolver( jobLoader JobLoader, stateLoader StateLoader, ) *StateResolver
func (*StateResolver) CheckExecutionStates ¶ added in v0.3.24
func (resolver *StateResolver) CheckExecutionStates( ctx context.Context, job model.Job, executionStateChecker ExecutionStateChecker, ) (bool, error)
iterate each execution and pass off []model.ExecutionState to the given function every execution must return true for this function to return true this is useful for example to say "do we have enough to begin verification"
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) ResultSummary ¶
func (*StateResolver) SetWaitTime ¶
func (resolver *StateResolver) SetWaitTime(maxWaitAttempts int, delay time.Duration)
func (*StateResolver) StateSummary ¶
func (*StateResolver) VerifiedSummary ¶
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