metascheduler

package
v1.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package metascheduler defines APIs for interacting with the DeepSquare Grid.

Package metascheduler providers implementations for interacting with the smart-contract.

Index

Constants

This section is empty.

Variables

View Source
var DivByZero = errors.New("division by zero")
View Source
var (
	// ErrNewRequestJobNotFound happens when submitting a job, but the job is not found.
	//
	// This would typically be used for panicking.
	ErrNewRequestJobNotFound = errors.New("new request job event not found")
)

Functions

func CreditToDuration

func CreditToDuration(
	prices metaschedulerabi.ProviderPrices,
	definition metaschedulerabi.JobDefinition,
	creditsWei *big.Int,
) (*big.Int, error)

CreditToDuration converts credits to a job duration based on pricing and resources allocation.

func DurationToCredit

func DurationToCredit(
	prices metaschedulerabi.ProviderPrices,
	definition metaschedulerabi.JobDefinition,
	durationMinutes *big.Int,
) *big.Int

DurationToCredit converts a job duration to credits based on pricing and resources allocation.

func IsPanicError

func IsPanicError(value byte) bool

IsPanicError checks if the byte of an error data is a panic error code.

func NewEventSubscriber

func NewEventSubscriber(
	rpc Backend,
	ws Backend,
) types.EventSubscriber

NewEventSubscriber creates an EventSubscriber used to watch events.

func ParseArrayLengthMismatch

func ParseArrayLengthMismatch(inputs []interface{}) error

func ParseDoubleEndedQueueError

func ParseDoubleEndedQueueError(name string, inputs []interface{}) error

func ParseError

func ParseError(name string, inputs []interface{}) error

func ParseInvalidNodesCount

func ParseInvalidNodesCount(inputs []interface{}) error

func ParseInvalidTotalCpus

func ParseInvalidTotalCpus(inputs []interface{}) error

func ParseInvalidTotalMem

func ParseInvalidTotalMem(inputs []interface{}) error

func ParseNoJob

func ParseNoJob(inputs []interface{}) error

func WrapError

func WrapError(originalErr error) (newErr error)

Types

type AlreadyDone

type AlreadyDone struct{}

func ParseAlreadyDone

func ParseAlreadyDone(_ []interface{}) *AlreadyDone

func (*AlreadyDone) Error

func (e *AlreadyDone) Error() string

type ArrayLengthMismatch

type ArrayLengthMismatch struct{}

func (*ArrayLengthMismatch) Error

func (e *ArrayLengthMismatch) Error() string

type Backend

type Backend struct {
	MetaschedulerAddress common.Address
	// EthereumBackend is the Ethereum Client.
	//
	// TODO: check if websocket or rpc.
	EthereumBackend
	// ChainID of the blockchain.
	ChainID *big.Int
	// PrivateKey of the user.
	UserPrivateKey *ecdsa.PrivateKey
}

Backend is a wrapper around the EthereumBackend used to interact with the Meta-Scheduler smart-contract.

type Banned

type Banned struct{}

func ParseBanned

func ParseBanned(_ []interface{}) *Banned

func (*Banned) Error

func (e *Banned) Error() string

type CustomerMetaSchedulerProviderOnly

type CustomerMetaSchedulerProviderOnly struct{}

func ParseCustomerMetaSchedulerProviderOnly

func ParseCustomerMetaSchedulerProviderOnly(
	inputs []interface{},
) *CustomerMetaSchedulerProviderOnly

func (*CustomerMetaSchedulerProviderOnly) Error

type CustomerOnly

type CustomerOnly struct {
	Current  common.Address
	Expected common.Address
}

func ParseCustomerOnly

func ParseCustomerOnly(inputs []interface{}) *CustomerOnly

func (*CustomerOnly) Error

func (e *CustomerOnly) Error() string

type DoubleEndedQueueEmpty

type DoubleEndedQueueEmpty struct{}

func ParseDoubleEndedQueueEmpty

func ParseDoubleEndedQueueEmpty(inputs []interface{}) *DoubleEndedQueueEmpty

func (*DoubleEndedQueueEmpty) Error

func (e *DoubleEndedQueueEmpty) Error() string

type DoubleEndedQueueOutOfBounds

type DoubleEndedQueueOutOfBounds struct{}

func ParseDoubleEndedQueueOutOfBounds

func ParseDoubleEndedQueueOutOfBounds(inputs []interface{}) *DoubleEndedQueueOutOfBounds

func (*DoubleEndedQueueOutOfBounds) Error

type EthereumBackend

type EthereumBackend interface {
	bind.ContractBackend
	bind.DeployBackend
}

EthereumBackend combines bind.ContractBackend and bind.DeployBackend.

type InsufficientFunds

type InsufficientFunds struct {
	Available *big.Int
	Required  *big.Int
}

func ParseInsufficientFunds

func ParseInsufficientFunds(inputs []interface{}) *InsufficientFunds

func (*InsufficientFunds) Error

func (e *InsufficientFunds) Error() string

type InvalidJob

type InvalidJob struct{}

func ParseInvalidJob

func ParseInvalidJob(inputs []interface{}) *InvalidJob

func (*InvalidJob) Error

func (e *InvalidJob) Error() string

type InvalidJobDefinition

type InvalidJobDefinition struct{}

func ParseInvalidJobDefinition

func ParseInvalidJobDefinition(
	inputs []interface{},
) *InvalidJobDefinition

func (*InvalidJobDefinition) Error

func (e *InvalidJobDefinition) Error() string

type InvalidNodesCount

type InvalidNodesCount struct{}

func (*InvalidNodesCount) Error

func (e *InvalidNodesCount) Error() string

type InvalidTotalCpus

type InvalidTotalCpus struct{}

func (*InvalidTotalCpus) Error

func (e *InvalidTotalCpus) Error() string

type InvalidTotalMem

type InvalidTotalMem struct{}

func (*InvalidTotalMem) Error

func (e *InvalidTotalMem) Error() string

type InvalidTransition

type InvalidTransition struct {
	From JobStatus
	To   JobStatus
}

func ParseInvalidTransition

func ParseInvalidTransition(inputs []interface{}) *InvalidTransition

func (*InvalidTransition) Error

func (e *InvalidTransition) Error() string

type JobHotStatusOnly

type JobHotStatusOnly struct {
	Current JobStatus
}

func ParseJobHotStatusOnly

func ParseJobHotStatusOnly(inputs []interface{}) *JobHotStatusOnly

func (*JobHotStatusOnly) Error

func (e *JobHotStatusOnly) Error() string

type JobProviderOnly

type JobProviderOnly struct {
	Current  common.Address
	Expected common.Address
}

func ParseJobProviderOnly

func ParseJobProviderOnly(inputs []interface{}) *JobProviderOnly

func (*JobProviderOnly) Error

func (e *JobProviderOnly) Error() string

type JobStatus

type JobStatus uint8

JobStatus is the job status stored in the smart-contract.

const (
	// JobStatusPending means the job has been submitted, but the meta-scheduler
	// hasn't considered to schedule it yet.
	JobStatusPending JobStatus = 0
	// JobStatusMetaScheduled means that the job has been scheduled to a cluster, but that cluster has not yet handled it.
	JobStatusMetaScheduled JobStatus = 1
	// JobStatusScheduled means that the job has been scheduled to a worker node.
	JobStatusScheduled JobStatus = 2
	// JobStatusRunning means that the job is running on a worker node.
	JobStatusRunning JobStatus = 3
	// JobStatusCancelled means that the job has been cancelled by the user or admin.
	JobStatusCancelled JobStatus = 4
	// JobStatusFinished means that the job has finished with success.
	JobStatusFinished JobStatus = 5
	// JobStatusFailed means that the job has failed.
	JobStatusFailed JobStatus = 6
	// JobStatusOutOfCredits means that the job has timed out.
	JobStatusOutOfCredits JobStatus = 7
	// JobStatusPanicked means that the job has failed from an unexpected error.
	JobStatusPanicked JobStatus = 8
	// JobStatusUnknown is a unknown state.
	JobStatusUnknown JobStatus = 255
)

func (JobStatus) String

func (s JobStatus) String() string

type MetaScheduledScheduledStatusOnly

type MetaScheduledScheduledStatusOnly struct {
	Current JobStatus
}

func ParseMetaScheduledScheduledStatusOnly

func ParseMetaScheduledScheduledStatusOnly(
	inputs []interface{},
) *MetaScheduledScheduledStatusOnly

func (*MetaScheduledScheduledStatusOnly) Error

type NewJobRequestDisabled

type NewJobRequestDisabled struct{}

func ParseNewJobRequestDisabled

func ParseNewJobRequestDisabled(inputs []interface{}) *NewJobRequestDisabled

func (*NewJobRequestDisabled) Error

func (e *NewJobRequestDisabled) Error() string

type NoJob

type NoJob struct{}

func (*NoJob) Error

func (e *NoJob) Error() string

type NoProvider

type NoProvider struct{}

func ParseNoProvider

func ParseNoProvider(_ []interface{}) *NoProvider

func (*NoProvider) Error

func (e *NoProvider) Error() string

type NoSpendingAuthority

type NoSpendingAuthority struct{}

func ParseNoSpendingAuthority

func ParseNoSpendingAuthority(inputs []interface{}) *NoSpendingAuthority

func (*NoSpendingAuthority) Error

func (e *NoSpendingAuthority) Error() string

type PanicError

type PanicError byte

PanicError is an native EVM error.

const (
	// PanicErrorAssertionError happens when `assert` fails.
	PanicErrorAssertionError PanicError = 0x1
	// PanicErrorArithmeticUnderOrOverflow happens when a number under or overflows.
	PanicErrorArithmeticUnderOrOverflow PanicError = 0x11
	// PanicErrorDivisionByZero happens when a number is divided by a zero denominator.
	PanicErrorDivisionByZero PanicError = 0x12
	// PanicErrorEnumConversionOutOfBounds happens when a number is out of bounds of an enum.
	PanicErrorEnumConversionOutOfBounds PanicError = 0x21
	// PanicErrorIncorrectlyEncodedStorageByteArray happens when byte array is badly encoded.
	PanicErrorIncorrectlyEncodedStorageByteArray PanicError = 0x22
	// PanicErrorPopOnEmptyArray happens when calling pop on an empty array.
	PanicErrorPopOnEmptyArray PanicError = 0x31
	// PanicErrorArrayAccessOutOfBounds happens when calling an element from an index out of bounds of an array.
	PanicErrorArrayAccessOutOfBounds PanicError = 0x32
	// PanicErrorTooMuchMemoryAllocated happens when there is too much memory allocated for the EVM.
	PanicErrorTooMuchMemoryAllocated PanicError = 0x41
	// PanicErrorZeroInitializedVariable happens when a variable is not initialized and it is forbidden to use the zero value of that variable.
	PanicErrorZeroInitializedVariable PanicError = 0x51
)

func (PanicError) Error

func (e PanicError) Error() string

type ProviderNotJoined

type ProviderNotJoined struct{}

func ParseProviderNotJoined

func ParseProviderNotJoined(inputs []interface{}) *ProviderNotJoined

func (*ProviderNotJoined) Error

func (e *ProviderNotJoined) Error() string

type RPCClientSet

type RPCClientSet struct {
	*Backend
}

RPCClientSet is a set of clients that interact with DeepSquare.

func NewRPCClientSet

func NewRPCClientSet(b Backend) *RPCClientSet

NewRPCClientSet creates an RPCClientSet.

func (*RPCClientSet) AllowanceManager

func (c *RPCClientSet) AllowanceManager() types.AllowanceManager

AllowanceManager creates an types.AllowanceManager.

func (*RPCClientSet) CreditManager

func (c *RPCClientSet) CreditManager() types.CreditManager

CreditManager creates a types.CreditManager.

func (*RPCClientSet) JobFetcher

func (c *RPCClientSet) JobFetcher() types.JobFetcher

JobFetcher creates a types.JobFetcher.

func (*RPCClientSet) JobScheduler

func (c *RPCClientSet) JobScheduler(
	sbatch sbatch.Service,
) types.JobScheduler

JobScheduler creates a types.JobScheduler.

func (*RPCClientSet) ProviderManager

func (c *RPCClientSet) ProviderManager() types.ProviderManager

ProviderManager creates a types.ProviderManager.

type RemainingTimeAboveLimit

type RemainingTimeAboveLimit struct {
	Remaining *big.Int
	Limit     *big.Int
}

func ParseRemainingTimeAboveLimit

func ParseRemainingTimeAboveLimit(
	inputs []interface{},
) *RemainingTimeAboveLimit

func (*RemainingTimeAboveLimit) Error

func (e *RemainingTimeAboveLimit) Error() string

type RunningColdStatusOnly

type RunningColdStatusOnly struct {
	Current JobStatus
}

func ParseRunningColdStatusOnly

func ParseRunningColdStatusOnly(
	inputs []interface{},
) *RunningColdStatusOnly

func (*RunningColdStatusOnly) Error

func (e *RunningColdStatusOnly) Error() string

type RunningScheduledStatusOnly

type RunningScheduledStatusOnly struct {
	Current JobStatus
}

func ParseRunningScheduledStatusOnly

func ParseRunningScheduledStatusOnly(
	inputs []interface{},
) *RunningScheduledStatusOnly

func (*RunningScheduledStatusOnly) Error

type SameStatusError

type SameStatusError struct{}

func ParseSameStatusError

func ParseSameStatusError(inputs []interface{}) *SameStatusError

func (*SameStatusError) Error

func (e *SameStatusError) Error() string

type WaitingApprovalOnly

type WaitingApprovalOnly struct{}

func ParseWaitingApprovalOnly

func ParseWaitingApprovalOnly(_ []interface{}) *WaitingApprovalOnly

func (*WaitingApprovalOnly) Error

func (e *WaitingApprovalOnly) Error() string

Jump to

Keyboard shortcuts

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