...

Package scheduler

import "scheduler/scheduler"
Overview
Index

Overview ▾

Package scheduler implements the core scheduler of the system.

Index ▾

Constants
func GetName() string
func GetScheduler() *types.SchedulerDescriptor
func SetScheduler(sched *types.SchedulerDescriptor) error
func Start()
type BadSchedulerParameters
    func (e BadSchedulerParameters) Error() string
type CannotChangeScheduler
    func (e CannotChangeScheduler) Error() string
type CannotRetrieveAction
    func (e CannotRetrieveAction) Error() string
type CannotRetrieveRecipientNode
    func (e CannotRetrieveRecipientNode) Error() string
type ExternalExecutionInfo
type ForwardScheduler
    func (s ForwardScheduler) GetFullName() string
    func (s ForwardScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s ForwardScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)
type JobCannotBeForwarded
    func (e JobCannotBeForwarded) Error() string
type JobCannotBeScheduled
    func (e JobCannotBeScheduled) Error() string
type JobDeliberatelyRejected
    func (e JobDeliberatelyRejected) Error() string
type JobResult
    func Schedule(req *types.ServiceRequest) (*JobResult, error)
    func ScheduleBypassAlgorithm(req *types.ServiceRequest) (*JobResult, error)
    func ScheduleForward(req *types.ServiceRequest) (*JobResult, error)
    func ScheduleReject(req *types.ServiceRequest) (*JobResult, error)
type LearningScheduler
    func (s LearningScheduler) GetFullName() string
    func (s LearningScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s LearningScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)
type NoSchedulingScheduler
    func (NoSchedulingScheduler) GetFullName() string
    func (s NoSchedulingScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s NoSchedulingScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)
type PeerResponseNil
    func (e PeerResponseNil) Error() string
type PowerOfNScheduler
    func (s PowerOfNScheduler) GetFullName() string
    func (s PowerOfNScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s PowerOfNScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)
type PowerOfNSchedulerTau
    func (s PowerOfNSchedulerTau) GetFullName() string
    func (s PowerOfNSchedulerTau) GetScheduler() *types.SchedulerDescriptor
    func (s PowerOfNSchedulerTau) Schedule(req *types.ServiceRequest) (*JobResult, error)
type RejectScheduler
    func (RejectScheduler) GetFullName() string
    func (s RejectScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s RejectScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)
type RoundRobinWithMasterScheduler
    func (s *RoundRobinWithMasterScheduler) GetFullName() string
    func (s *RoundRobinWithMasterScheduler) GetScheduler() *types.SchedulerDescriptor
    func (s *RoundRobinWithMasterScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

Package files

errors.go forward_scheduler.go learning_scheduler.go no_scheduler.go pwr_n_scheduler.go pwr_n_tau_scheduler.go reject_scheduler.go rr_with_master_scheduler.go scheduler.go types.go utils.go

Constants

const ForwardSchedulerName = "ForwardScheduler"
const LearningSchedulerHeaderKeyAction = "X-P2pfaas-Scheduler-Learning-Action"
const LearningSchedulerHeaderKeyEid = "X-P2pfaas-Scheduler-Learning-Eid"
const LearningSchedulerHeaderKeyEps = "X-P2pfaas-Scheduler-Learning-Eps"
const LearningSchedulerHeaderKeyFps = "X-P2pfaas-Scheduler-Learning-Fps"
const LearningSchedulerHeaderKeyState = "X-P2pfaas-Scheduler-Learning-State"
const LearningSchedulerHeaderKeyTaskType = "X-P2pfaas-Scheduler-Learning-Task-Type"
const LearningSchedulerName = "LearningScheduler"
const NoSchedulingSchedulerName = "NoScheduler"
const PowerOfNSchedulerName = "PowerOfNScheduler"
const PowerOfNSchedulerTauName = "PowerOfNSchedulerTau"
const RejectSchedulerSchedulerName = "RejectScheduler"
const RoundRobinWithMasterSchedulerName = "RoundRobinWithMasterScheduler"

func GetName

func GetName() string

GetName returns the friendly name of current set scheduler

func GetScheduler

func GetScheduler() *types.SchedulerDescriptor

GetScheduler returns the types.SchedulerDescriptor object of current set scheduler

func SetScheduler

func SetScheduler(sched *types.SchedulerDescriptor) error

SetScheduler replaces the current scheduler with the passed one

func Start

func Start()

type BadSchedulerParameters

type BadSchedulerParameters struct{}

func (BadSchedulerParameters) Error

func (e BadSchedulerParameters) Error() string

type CannotChangeScheduler

type CannotChangeScheduler struct{}

func (CannotChangeScheduler) Error

func (e CannotChangeScheduler) Error() string

type CannotRetrieveAction

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

func (CannotRetrieveAction) Error

func (e CannotRetrieveAction) Error() string

type CannotRetrieveRecipientNode

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

func (CannotRetrieveRecipientNode) Error

func (e CannotRetrieveRecipientNode) Error() string

type ExternalExecutionInfo

ExternalExecutionInfo holds information about the external execution of the task

type ExternalExecutionInfo struct {
    PeersList []types.PeersListMember `json:"peers_list"`
}

type ForwardScheduler

ForwardScheduler scheduler forwards all the requests to a random node, this is used for testing purposes

type ForwardScheduler struct {
    // MaxHops is the maximum number of hops that a request can be subjected to before being executed
    MaxHops uint
}

func (ForwardScheduler) GetFullName

func (s ForwardScheduler) GetFullName() string

func (ForwardScheduler) GetScheduler

func (s ForwardScheduler) GetScheduler() *types.SchedulerDescriptor

func (ForwardScheduler) Schedule

func (s ForwardScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

Schedule a service request. This call is blocking until the job has been executed locally or externally.

type JobCannotBeForwarded

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

func (JobCannotBeForwarded) Error

func (e JobCannotBeForwarded) Error() string

type JobCannotBeScheduled

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

func (JobCannotBeScheduled) Error

func (e JobCannotBeScheduled) Error() string

type JobDeliberatelyRejected

type JobDeliberatelyRejected struct {
}

func (JobDeliberatelyRejected) Error

func (e JobDeliberatelyRejected) Error() string

type JobResult

JobResult represents the result of the execution of a task

type JobResult struct {
    Response              *types.APIResponse     `json:"response"`
    ProbingMessages       uint                   `json:"probing_messages"`
    ExternalExecution     bool                   `json:"external_execution"`
    ExternalExecutionInfo *ExternalExecutionInfo `json:"external_executed_info"`
    ErrorExecution        bool                   `json:"error_execution"`
    TimingsStart          *types.TimingsStart    `json:"timings_start"`
    Timings               *types.Timings         `json:"timings"`
    ResponseHeaders       *map[string]string     `json:"response_headers"` // custom headers to be returned to clients
    Scheduler             string                 `json:"scheduler"`        // the scheduler that executed the job
}

func Schedule

func Schedule(req *types.ServiceRequest) (*JobResult, error)

Schedule schedules a service request with the current set scheduler

func ScheduleBypassAlgorithm

func ScheduleBypassAlgorithm(req *types.ServiceRequest) (*JobResult, error)

ScheduleBypassAlgorithm schedules a service request with the NoScheduler algorithm which always execute locally the function

func ScheduleForward

func ScheduleForward(req *types.ServiceRequest) (*JobResult, error)

ScheduleForward schedules a service request with the ForwardScheduler algorithm which always forward the request to a random node

func ScheduleReject

func ScheduleReject(req *types.ServiceRequest) (*JobResult, error)

ScheduleReject schedules a service request with the RejectScheduler algorithm which always reject the request

type LearningScheduler

LearningScheduler is a scheduler with makes scheduling decisions based on the Learner service which implements RL models

type LearningScheduler struct {
    // NumberOfTaskTypes is the number of task types which can arrive to the node
    NumberOfTaskTypes uint64
}

func (LearningScheduler) GetFullName

func (s LearningScheduler) GetFullName() string

func (LearningScheduler) GetScheduler

func (s LearningScheduler) GetScheduler() *types.SchedulerDescriptor

func (LearningScheduler) Schedule

func (s LearningScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

Schedule a service request. This call is blocking until the job has been executed locally or externally.

type NoSchedulingScheduler

NoSchedulingScheduler is a scheduler which executes all the requests locally

type NoSchedulingScheduler struct {
    // Loss tells if tasks are loss when there are no free slots for executing the task in parallel with others
    Loss bool
}

func (NoSchedulingScheduler) GetFullName

func (NoSchedulingScheduler) GetFullName() string

func (NoSchedulingScheduler) GetScheduler

func (s NoSchedulingScheduler) GetScheduler() *types.SchedulerDescriptor

func (NoSchedulingScheduler) Schedule

func (s NoSchedulingScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

type PeerResponseNil

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

func (PeerResponseNil) Error

func (e PeerResponseNil) Error() string

type PowerOfNScheduler

PowerOfNScheduler implement the power-of-n choices based scheduler

type PowerOfNScheduler struct {
    // F is the fan-out, that is the number of probed nodes
    F uint
    // T is threshold, that from which number of currently executing tasks the probing to others is started
    T uint
    // Loss tells if tasks are loss when there are no free slots for executing the task in parallel with others
    Loss bool
    // MaxHops is the maximum number of hops that a request can be subjected to before being executed
    MaxHops uint // maximum number of hops
}

func (PowerOfNScheduler) GetFullName

func (s PowerOfNScheduler) GetFullName() string

func (PowerOfNScheduler) GetScheduler

func (s PowerOfNScheduler) GetScheduler() *types.SchedulerDescriptor

func (PowerOfNScheduler) Schedule

func (s PowerOfNScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

Schedule a service request. This call is blocking until the job has been executed locally or externally.

type PowerOfNSchedulerTau

PowerOfNSchedulerTau implements the power-of-n choices scheduler but a delay is added before probing nodes

type PowerOfNSchedulerTau struct {
    // F is the fan-out, that is the number of probed nodes
    F uint
    // T is threshold, that from which number of currently executing tasks the probing to others is started
    T uint
    // Loss tells if tasks are loss when there are no free slots for executing the task in parallel with others
    Loss bool
    // MaxHops is the maximum number of hops that a request can be subjected to before being executed
    MaxHops uint
    // Tau is the amount of time the probing must be delayed
    Tau time.Duration
}

func (PowerOfNSchedulerTau) GetFullName

func (s PowerOfNSchedulerTau) GetFullName() string

func (PowerOfNSchedulerTau) GetScheduler

func (s PowerOfNSchedulerTau) GetScheduler() *types.SchedulerDescriptor

func (PowerOfNSchedulerTau) Schedule

func (s PowerOfNSchedulerTau) Schedule(req *types.ServiceRequest) (*JobResult, error)

Schedule a service request. This call is blocking until the job has been executed locally or externally.

type RejectScheduler

RejectScheduler is a scheduler which rejects all the tasks

type RejectScheduler struct {
}

func (RejectScheduler) GetFullName

func (RejectScheduler) GetFullName() string

func (RejectScheduler) GetScheduler

func (s RejectScheduler) GetScheduler() *types.SchedulerDescriptor

func (RejectScheduler) Schedule

func (s RejectScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)

type RoundRobinWithMasterScheduler

RoundRobinWithMasterScheduler is a scheduler which implements a round-robin fashion with a master node

type RoundRobinWithMasterScheduler struct {
    // Master tells if the current node is the master node
    Master bool
    // MasterIP stores the IP address of the master node
    MasterIP string
    // Loss tells if tasks are loss when there are no free slots for executing the task in parallel with others
    Loss bool
    // contains filtered or unexported fields
}

func (*RoundRobinWithMasterScheduler) GetFullName

func (s *RoundRobinWithMasterScheduler) GetFullName() string

func (*RoundRobinWithMasterScheduler) GetScheduler

func (s *RoundRobinWithMasterScheduler) GetScheduler() *types.SchedulerDescriptor

func (*RoundRobinWithMasterScheduler) Schedule

func (s *RoundRobinWithMasterScheduler) Schedule(req *types.ServiceRequest) (*JobResult, error)