metascheduler

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetaschedulerABI *abi.ABI
)

Functions

func IsPanicError

func IsPanicError(value byte) bool

func LabelsContains added in v0.14.3

func LabelsContains(a, b []metaschedulerabi.Label) bool

LabelsContains returns true if a is included in b

func MergeLabels

MergeLabels b on a.

b has priority over a.

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 ProcessLabels

func ProcessLabels(ll []metaschedulerabi.Label) []metaschedulerabi.Label

func ProviderPricesEqual added in v0.14.3

func WrapError

func WrapError(originalErr error) (newErr error)

Types

type AlreadyDone

type AlreadyDone struct{}

func ParseAlreadyDone

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

func (*AlreadyDone) Error

func (e *AlreadyDone) Error() string

type ArrayLengthMismatch

type ArrayLengthMismatch struct{}

func (*ArrayLengthMismatch) Error

func (e *ArrayLengthMismatch) Error() string

type Banned

type Banned struct{}

func ParseBanned

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

func (*Banned) Error

func (e *Banned) Error() string

type Client

type Client struct {
	bind.DeployBackend
	// contains filtered or unexported fields
}

Client handles communications with the smart contract.

func (*Client) Claim

func (c *Client) Claim(ctx context.Context) error

Claim a job.

If the queue is not empty, it will claim the job and return true. Else, it will return false. Else, it will return false and an error.

func (*Client) ClaimCancelling

func (c *Client) ClaimCancelling(ctx context.Context) error

ClaimCancelling a cancelling call.

func (*Client) ClaimTopUp

func (c *Client) ClaimTopUp(ctx context.Context) error

ClaimTopUp a top up call.

func (*Client) GetJob

func (c *Client) GetJob(ctx context.Context, jobID [32]byte) (*Job, error)

func (*Client) GetJobStatus

func (c *Client) GetJobStatus(ctx context.Context, jobID [32]byte) (JobStatus, error)

GetJobStatus fetches the job status.

func (*Client) GetJobs

func (c *Client) GetJobs(ctx context.Context) (*ProviderJobIterator, error)

func (*Client) GetOldInfo

func (c *Client) GetOldInfo(ctx context.Context) (*metaschedulerabi.Provider, error)

func (*Client) GetProviderAddress

func (c *Client) GetProviderAddress() common.Address

func (*Client) IsRequestNewJobEnabled added in v0.12.10

func (c *Client) IsRequestNewJobEnabled(ctx context.Context) (bool, error)

func (*Client) RefuseJob

func (c *Client) RefuseJob(
	ctx context.Context,
	jobID [32]byte,
) error

RefuseJob rejects a job from the metascheduler.

func (*Client) Register

Register a cluster

Will send a transaction to register the cluster.

func (*Client) SetJobStatus

func (c *Client) SetJobStatus(
	ctx context.Context,
	jobID [32]byte,
	status JobStatus,
	jobDurationMinute uint64,
	opts ...SetJobStatusOption,
) error

SetJobStatus reports the [State] state to the metascheduler.

func (*Client) WatchEvents

func (c *Client) WatchEvents(
	ctx context.Context,
	claimNextTopUpJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimNextTopUpJobEvent,
	claimNextCancellingJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimNextCancellingJobEvent,
	claimJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimJobEvent,
) (event.Subscription, error)

WatchEvents observes the incoming ClaimNextTopUpJobEvent, ClaimNextCancellingJobEvent and ClaimJobEvent.

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 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 Job

type Job struct {
	JobID            [32]byte
	Status           JobStatus
	CustomerAddr     common.Address
	ProviderAddr     common.Address
	Definition       metaschedulerabi.JobDefinition
	Cost             metaschedulerabi.JobCost
	Time             metaschedulerabi.JobTime
	JobName          [32]byte
	HasCancelRequest bool
	LastError        string
}

func FromStructToJob

func FromStructToJob(s metaschedulerabi.Job) *Job

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
const (
	JobStatusPending       JobStatus = 0
	JobStatusMetaScheduled JobStatus = 1
	JobStatusScheduled     JobStatus = 2
	JobStatusRunning       JobStatus = 3
	JobStatusCancelled     JobStatus = 4
	JobStatusFinished      JobStatus = 5
	JobStatusFailed        JobStatus = 6
	JobStatusOutOfCredits  JobStatus = 7
	JobStatusPanicked      JobStatus = 8
	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 MetaScheduler

type MetaScheduler interface {
	IsRequestNewJobEnabled(ctx context.Context) (bool, error)
	// Claim a job for scheduling.
	Claim(ctx context.Context) error
	// Claim cancelling calls.
	ClaimCancelling(ctx context.Context) error
	// Claim top up calls.
	ClaimTopUp(ctx context.Context) error
	// Refuse a job for metascheduling.
	RefuseJob(ctx context.Context, jobID [32]byte) error
	// WatchEvents observes the incoming ClaimNextTopUpJobEvent, ClaimNextCancellingJobEvent and ClaimJobEvent.
	WatchEvents(
		ctx context.Context,
		claimNextTopUpJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimNextTopUpJobEvent,
		claimNextCancellingJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimNextCancellingJobEvent,
		claimJobEvents chan<- *metaschedulerabi.MetaSchedulerClaimJobEvent,
	) (event.Subscription, error)
	// GetProviderAddress fetches the provider public address.
	GetProviderAddress() common.Address
	// GetOldInfo fetches the last registration provider information.
	GetOldInfo(ctx context.Context) (*metaschedulerabi.Provider, error)
	// GetJobStatus fetches the job status.
	GetJobStatus(ctx context.Context, jobID [32]byte) (JobStatus, error)
	SetJobStatus(
		ctx context.Context,
		jobID [32]byte,
		status JobStatus,
		jobDurationMinute uint64,
		opts ...SetJobStatusOption,
	) error
	Register(
		ctx context.Context,
		hardware metaschedulerabi.ProviderHardware,
		prices metaschedulerabi.ProviderPrices,
		labels []metaschedulerabi.Label,
	) error
	// GetJob fetches a job.
	GetJob(ctx context.Context, jobID [32]byte) (*Job, error)
	// GetJobs fetches the jobs of the provider.
	GetJobs(ctx context.Context) (*ProviderJobIterator, error)
}

func NewClient

func NewClient(
	chainID *big.Int,
	metaschedulerAddress common.Address,
	deployBackend bind.DeployBackend,
	rpc bind.ContractBackend,
	ws bind.ContractBackend,
	pk *ecdsa.PrivateKey,
) MetaScheduler

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(inputs []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
const (
	PanicErrorAssertionError                     PanicError = 0x1
	PanicErrorArithmeticUnderOrOverflow          PanicError = 0x11
	PanicErrorDivisionByZero                     PanicError = 0x12
	PanicErrorEnumConversionOutOfBounds          PanicError = 0x21
	PanicErrorIncorrectlyEncodedStorageByteArray PanicError = 0x22
	PanicErrorPopOnEmptyArray                    PanicError = 0x31
	PanicErrorArrayAccessOutOfBounds             PanicError = 0x32
	PanicErrorTooMuchMemoryAllocated             PanicError = 0x41
	PanicErrorZeroInitializedVariable            PanicError = 0x51
)

func (PanicError) Error

func (e PanicError) Error() string

type ProviderJobIterator

type ProviderJobIterator struct {
	Job *Job
	*metaschedulerabi.MetaSchedulerClaimJobEventIterator
	// contains filtered or unexported fields
}

func (*ProviderJobIterator) Next

func (it *ProviderJobIterator) Next(ctx context.Context) bool

type ProviderNotJoined

type ProviderNotJoined struct{}

func ParseProviderNotJoined

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

func (*ProviderNotJoined) Error

func (e *ProviderNotJoined) Error() string

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 SetJobStatusOption

type SetJobStatusOption func(*setJobStatusOptions)

func SetJobStatusWithError

func SetJobStatusWithError(err error) SetJobStatusOption

func SetJobStatusWithExitCode added in v0.13.0

func SetJobStatusWithExitCode(exitCode int64) SetJobStatusOption

type WaitingApprovalOnly

type WaitingApprovalOnly struct{}

func ParseWaitingApprovalOnly

func ParseWaitingApprovalOnly(inputs []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