Documentation ¶
Overview ¶
Package metascheduler defines APIs for interacting with the DeepSquare Grid.
Package metascheduler providers implementations for interacting with the smart-contract.
Index ¶
- Variables
- func CreditToDuration(prices metaschedulerabi.ProviderPrices, ...) (*big.Int, error)
- func DurationToCredit(prices metaschedulerabi.ProviderPrices, ...) *big.Int
- func IsPanicError(value byte) bool
- func NewEventSubscriber(rpc Backend, ws Backend) types.EventSubscriber
- func ParseArrayLengthMismatch(inputs []interface{}) error
- func ParseDoubleEndedQueueError(name string, inputs []interface{}) error
- func ParseError(name string, inputs []interface{}) error
- func ParseInvalidNodesCount(inputs []interface{}) error
- func ParseInvalidTotalCpus(inputs []interface{}) error
- func ParseInvalidTotalMem(inputs []interface{}) error
- func ParseNoJob(inputs []interface{}) error
- func WrapError(originalErr error) (newErr error)
- type AlreadyDone
- type ArrayLengthMismatch
- type Backend
- type Banned
- type CustomerMetaSchedulerProviderOnly
- type CustomerOnly
- type DoubleEndedQueueEmpty
- type DoubleEndedQueueOutOfBounds
- type EthereumBackend
- type InsufficientFunds
- type InvalidJob
- type InvalidJobDefinition
- type InvalidNodesCount
- type InvalidTotalCpus
- type InvalidTotalMem
- type InvalidTransition
- type JobHotStatusOnly
- type JobProviderOnly
- type JobStatus
- type MetaScheduledScheduledStatusOnly
- type NewJobRequestDisabled
- type NoJob
- type NoProvider
- type NoSpendingAuthority
- type PanicError
- type ProviderNotJoined
- type RPCClientSet
- func (c *RPCClientSet) AllowanceManager() types.AllowanceManager
- func (c *RPCClientSet) CreditManager() types.CreditManager
- func (c *RPCClientSet) JobFetcher() types.JobFetcher
- func (c *RPCClientSet) JobScheduler(sbatch sbatch.Service) types.JobScheduler
- func (c *RPCClientSet) ProviderManager() types.ProviderManager
- type RemainingTimeAboveLimit
- type RunningColdStatusOnly
- type RunningScheduledStatusOnly
- type SameStatusError
- type WaitingApprovalOnly
Constants ¶
This section is empty.
Variables ¶
var DivByZero = errors.New("division by zero")
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 ¶
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 ParseError ¶
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
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 CustomerMetaSchedulerProviderOnly ¶
type CustomerMetaSchedulerProviderOnly struct{}
func ParseCustomerMetaSchedulerProviderOnly ¶
func ParseCustomerMetaSchedulerProviderOnly( inputs []interface{}, ) *CustomerMetaSchedulerProviderOnly
func (*CustomerMetaSchedulerProviderOnly) Error ¶
func (e *CustomerMetaSchedulerProviderOnly) Error() string
type CustomerOnly ¶
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 ¶
func (e *DoubleEndedQueueOutOfBounds) Error() string
type EthereumBackend ¶
type EthereumBackend interface { bind.ContractBackend bind.DeployBackend }
EthereumBackend combines bind.ContractBackend and bind.DeployBackend.
type InsufficientFunds ¶
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 ¶
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 ¶
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 )
type MetaScheduledScheduledStatusOnly ¶
type MetaScheduledScheduledStatusOnly struct {
Current JobStatus
}
func ParseMetaScheduledScheduledStatusOnly ¶
func ParseMetaScheduledScheduledStatusOnly( inputs []interface{}, ) *MetaScheduledScheduledStatusOnly
func (*MetaScheduledScheduledStatusOnly) Error ¶
func (e *MetaScheduledScheduledStatusOnly) Error() string
type NewJobRequestDisabled ¶
type NewJobRequestDisabled struct{}
func ParseNewJobRequestDisabled ¶
func ParseNewJobRequestDisabled(inputs []interface{}) *NewJobRequestDisabled
func (*NewJobRequestDisabled) Error ¶
func (e *NewJobRequestDisabled) 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 ¶
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 ¶
func (e *RunningScheduledStatusOnly) Error() string
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
Source Files ¶
- metascheduler_allowancemanager.go
- metascheduler_backend.go
- metascheduler_creditmanager.go
- metascheduler_doc.go
- metascheduler_error.go
- metascheduler_job_status.go
- metascheduler_jobfetcher.go
- metascheduler_jobscheduler.go
- metascheduler_providermanager.go
- metascheduler_rpc.go
- metascheduler_utils.go
- metascheduler_ws.go