bidstrategy

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BidStrategy

type BidStrategy interface {
	ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
	ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, resourceUsage model.ResourceUsageData) (BidStrategyResponse, error)
}

func FromJobSelectionPolicy

func FromJobSelectionPolicy(jsp model.JobSelectionPolicy) BidStrategy

Create a BidStrategy that implements the passed JobSelectionPolicy.

type BidStrategyRequest

type BidStrategyRequest struct {
	NodeID string
	Job    model.Job
}

type BidStrategyResponse

type BidStrategyResponse struct {
	ShouldBid bool
	Reason    string
}

func NewShouldBidResponse

func NewShouldBidResponse() BidStrategyResponse

type ChainedBidStrategy

type ChainedBidStrategy struct {
	Strategies []BidStrategy
}

func NewChainedBidStrategy

func NewChainedBidStrategy(strategies ...BidStrategy) *ChainedBidStrategy

func (*ChainedBidStrategy) AddStrategy

func (c *ChainedBidStrategy) AddStrategy(strategy BidStrategy)

AddStrategy Add new strategy to the end of the chain

func (*ChainedBidStrategy) ShouldBid

ShouldBid Iterate over all strategies, and return shouldBid if no error is thrown and none of the strategies return should not bid.

func (*ChainedBidStrategy) ShouldBidBasedOnUsage

func (c *ChainedBidStrategy) ShouldBidBasedOnUsage(
	ctx context.Context, request BidStrategyRequest, usage model.ResourceUsageData) (BidStrategyResponse, error)

ShouldBidBasedOnUsage Iterate over all strategies, and return shouldBid if no error is thrown and none of the strategies return should not bid.

type DistanceDelayStrategy

type DistanceDelayStrategy struct {
	// contains filtered or unexported fields
}

func (DistanceDelayStrategy) ShouldBid

func (DistanceDelayStrategy) ShouldBidBasedOnUsage

type DistanceDelayStrategyParams

type DistanceDelayStrategyParams struct {
	NetworkSize int
}

type EnginesInstalledStrategy

type EnginesInstalledStrategy struct {
	// contains filtered or unexported fields
}

func (*EnginesInstalledStrategy) ShouldBid

func (*EnginesInstalledStrategy) ShouldBidBasedOnUsage

type EnginesInstalledStrategyParams

type EnginesInstalledStrategyParams struct {
	Storages   storage.StorageProvider
	Executors  executor.ExecutorProvider
	Verifiers  verifier.VerifierProvider
	Publishers publisher.PublisherProvider
}

type ExternalCommandStrategy

type ExternalCommandStrategy struct {
	// contains filtered or unexported fields
}

func (*ExternalCommandStrategy) ShouldBid

func (*ExternalCommandStrategy) ShouldBidBasedOnUsage

type ExternalCommandStrategyParams

type ExternalCommandStrategyParams struct {
	Command string
}

type ExternalHTTPStrategy

type ExternalHTTPStrategy struct {
	// contains filtered or unexported fields
}

func NewExternalHTTPStrategy

func NewExternalHTTPStrategy(params ExternalHTTPStrategyParams) *ExternalHTTPStrategy

func (*ExternalHTTPStrategy) ShouldBid

func (*ExternalHTTPStrategy) ShouldBidBasedOnUsage

type ExternalHTTPStrategyParams

type ExternalHTTPStrategyParams struct {
	URL string
}

type InputLocalityStrategy

type InputLocalityStrategy struct {
	// contains filtered or unexported fields
}

func (*InputLocalityStrategy) ShouldBid

func (*InputLocalityStrategy) ShouldBidBasedOnUsage

type InputLocalityStrategyParams

type InputLocalityStrategyParams struct {
	Locality  model.JobSelectionDataLocality
	Executors executor.ExecutorProvider
}

type JobSelectionPolicyProbeData

type JobSelectionPolicyProbeData struct {
	NodeID        string                 `json:"node_id"`
	JobID         string                 `json:"job_id"`
	Spec          model.Spec             `json:"spec"`
	ExecutionPlan model.JobExecutionPlan `json:"execution_plan"`
}

the JSON data we send to http or exec probes TODO: can we just use the BidStrategyRequest struct?

type NetworkingStrategy

type NetworkingStrategy struct {
	Accept bool
}

func NewNetworkingStrategy

func NewNetworkingStrategy(accept bool) *NetworkingStrategy

func (*NetworkingStrategy) ShouldBid

ShouldBid implements BidStrategy

func (*NetworkingStrategy) ShouldBidBasedOnUsage

func (s *NetworkingStrategy) ShouldBidBasedOnUsage(
	ctx context.Context,
	request BidStrategyRequest,
	resourceUsage model.ResourceUsageData,
) (BidStrategyResponse, error)

ShouldBidBasedOnUsage implements BidStrategy

type StatelessJobStrategy

type StatelessJobStrategy struct {
	// contains filtered or unexported fields
}

func NewStatelessJobStrategy

func NewStatelessJobStrategy(params StatelessJobStrategyParams) *StatelessJobStrategy

func (*StatelessJobStrategy) ShouldBid

func (*StatelessJobStrategy) ShouldBidBasedOnUsage

type StatelessJobStrategyParams

type StatelessJobStrategyParams struct {
	RejectStatelessJobs bool
}

type TimeoutStrategy

type TimeoutStrategy struct {
	// contains filtered or unexported fields
}

func NewTimeoutStrategy

func NewTimeoutStrategy(params TimeoutStrategyParams) *TimeoutStrategy

func (*TimeoutStrategy) ShouldBid

type TimeoutStrategyParams

type TimeoutStrategyParams struct {
	MaxJobExecutionTimeout time.Duration
	MinJobExecutionTimeout time.Duration

	JobExecutionTimeoutClientIDBypassList []string
}

Jump to

Keyboard shortcuts

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