model

package
v0.0.0-...-0f92b6b Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GridSdr

type GridSdr struct {
	common.Node
	// contains filtered or unexported fields
}

GridSdr describes the properties of one grid scheduler

func InitGridSdr

func InitGridSdr(id int, addr string, dsAddr string) GridSdr

InitGridSdr creates a grid scheduler.

func (*GridSdr) AddJobs

func (gs *GridSdr) AddJobs(jobs *[]Job, reply *int) error

AddJobs appends new jobs into the jobs queue. NOTE: this function should not be called directly by the client, it requires CS.

func (*GridSdr) AddJobsViaUser

func (gs *GridSdr) AddJobsViaUser(jobs *[]Job, reply *int) error

AddJobsViaUser is called by the client to add job(s) to the tasks queue, it returns when the job is synchronised.

func (*GridSdr) DropJobs

func (gs *GridSdr) DropJobs(n *int, reply *int) error

DropJobs deletes the first n jobs from incomingJobs

func (*GridSdr) GetState

func (gs *GridSdr) GetState(x *int, state *GridSdrState) error

GetState RPC used by a GS when it first starts up to copy the job lists TODO some repeated code in this function

func (*GridSdr) RecvMsg

func (gs *GridSdr) RecvMsg(args *RPCArgs, reply *int) error

RecvMsg is called remotely, it updates the Lamport clock first and then performs tasks depending on the message type. Note that this RPC call works when the GS is not ready.

func (*GridSdr) RecvScheduledJobs

func (gs *GridSdr) RecvScheduledJobs(jobs *[]Job, reply *int) error

RecvScheduledJobs RPC is for appending jobs to the scheduledJobs list NOTE: this function should not be called directly by the client, it requires CS.

func (*GridSdr) RecvScheduledJobsFromRM

func (gs *GridSdr) RecvScheduledJobsFromRM(jobs *[]Job, reply *int) error

RecvScheduledJobsFromRM RPC is for appending jobs to the scheduledJobs list but called by the RM it needs to use the CS to sync the new jobs with the GS cluster

func (*GridSdr) RemoveCompletedJobs

func (gs *GridSdr) RemoveCompletedJobs(jobs *[]int64, reply *int) error

RemoveCompletedJobs is called by another GS to remove job(s) from the scheduledJobAddChan

func (*GridSdr) Run

func (gs *GridSdr) Run()

Run is the main function for GridSdr, it starts all its services, do not run it more than once.

func (*GridSdr) SyncCompletedJobs

func (gs *GridSdr) SyncCompletedJobs(jobs *[]int64, reply *int) error

SyncCompletedJobs is called by the RM when job(s) are completed. NOTE: it acquire a critical section and propagate the change to everybody.

type GridSdrState

type GridSdrState struct {
	IncomingJobs  []Job
	ScheduledJobs []Job
	Clock         int64
}

GridSdrState is an RPC argument for synchronising states when GS first start up

type Job

type Job struct {
	ID         int64 // must be unique
	Duration   time.Duration
	ResMan     string
	StartTime  time.Time
	FinishTime time.Time
}

Job are entities can be executed by worker nodes

type RPCArgs

type RPCArgs struct {
	ID    int
	Addr  string
	Type  common.MsgType
	Clock int64
}

RPCArgs is the arguments for RPC calls between grid schedulers and/or resource maanagers

type ResMan

type ResMan struct {
	common.Node
	// contains filtered or unexported fields
}

ResMan the resource manager

func InitResMan

func InitResMan(n int, id int, addr string, dsAddr string) ResMan

InitResMan initialises and returns a ResMan

func (*ResMan) AddJob

func (rm *ResMan) AddJob(jobs *[]Job, reply *int) error

AddJob RPC, only used by GridSdr

func (*ResMan) AddJobsViaUser

func (rm *ResMan) AddJobsViaUser(jobs *[]Job, reply *int) error

AddJobsViaUser PRC, only used by CLI

func (*ResMan) RecvMsg

func (rm *ResMan) RecvMsg(args *RPCArgs, reply *int) error

RecvMsg PRC call

func (*ResMan) Run

func (rm *ResMan) Run()

Run starts the ResMan

type WorkerDone

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

WorkerDone is indicating when a job is done, it's used in channels

type WorkerTask

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

WorkerTask represents a job/task that can be executed by a worker node every Job (initially from the user) gets converted into a WorkerTask

Jump to

Keyboard shortcuts

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