core

package
v0.0.0-...-c331985 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

This resource implementation focus on `Alloc`, and `Dealloc` functionalities. The internal values a resource struct hold are not designed to be accissible (because of the support of MultiResource).

Index

Constants

View Source
const (
	FULL_HEALTH         = 3
	HEARTBEAT_INTERVAL  = 10 * time.Second
	HEARTBEAT_TOLERANCE = 3
)
View Source
const (
	CMD_REG mgrCMD = iota
	CMD_UNR
	CMD_TRM
	CMD_STA
	CMD_CAN
)
View Source
const (
	TIMESTAT_NSAMPLE = 8
	MAXDURATION      = 100 * 365 * 24 * time.Hour
)
View Source
const STATSPAN = 15 * time.Minute
View Source
const STRAWMANSPAN = 30 * time.Minute

Variables

View Source
var TIMEDUR = regexp.MustCompile(`(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)`)

Functions

func And

func And(rs ...Resource) *multiResource

func Capacity

func Capacity(v0 int) *capacity

func Cores

func Cores(n0 interface{}) *cores

func Memory

func Memory(m0 uint) *memory

func MultiResource

func MultiResource(rs []Resource) *multiResource

func StatLoop

func StatLoop()

func WTime

func WTime(t, softT uint64, group string, countdown bool) *wtime

Types

type ControlMsg

type ControlMsg struct {
	Cmd  string       `msg:"cmd"`
	Name *string      `msg:"name,omitempty"`
	Res  *PossibleRes `msg:"res,omitempty"`
	Obj  *msgp.Raw    `msg:"obj,omitempty"`
}

func (*ControlMsg) DecodeMsg

func (z *ControlMsg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ControlMsg) EncodeMsg

func (z *ControlMsg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ControlMsg) MarshalMsg

func (z *ControlMsg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ControlMsg) Msgsize

func (z *ControlMsg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ControlMsg) UnmarshalMsg

func (z *ControlMsg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type FnMsg

type FnMsg struct {
	Tid uint        `msg:"tid"`
	Res PossibleRes `msg:"res"`
	// Usually store the pickled Python function to be executed;
	// when as an approval stub, this stores the name (string) of the sworker instance.
	Func msgp.Raw `msg:"func"`
}

func (*FnMsg) DecodeMsg

func (z *FnMsg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*FnMsg) EncodeMsg

func (z *FnMsg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*FnMsg) MarshalMsg

func (z *FnMsg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*FnMsg) Msgsize

func (z *FnMsg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*FnMsg) UnmarshalMsg

func (z *FnMsg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GrainExecutor

type GrainExecutor struct {
	Resultq chan ResultMsg
	// contains filtered or unexported fields
}

func NewGrainExecutor

func NewGrainExecutor(ctx context.Context, url string, strawmanSwarm int, stager *SpecializedStager) *GrainExecutor

func (*GrainExecutor) Close

func (ge *GrainExecutor) Close()

func (*GrainExecutor) Filter

func (ge *GrainExecutor) Filter(pred taskPredicateFn)

Filter all queued and running tasks base on a tid criterion

func (*GrainExecutor) Run

func (ge *GrainExecutor) Run()

func (*GrainExecutor) Submit

func (ge *GrainExecutor) Submit(id uint, res Resource, rawFn msgp.Raw)

func (*GrainExecutor) SubmitPrioritized

func (ge *GrainExecutor) SubmitPrioritized(id uint, res Resource, rawFn msgp.Raw)

type GrainManager

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

GrainManager manages workers and their resources.

type IRemote

type IRemote interface {
	// contains filtered or unexported methods
}

type PossibleRes

type PossibleRes struct {
	Cores    *struct{ N []uint } `msg:"Cores,omitempty"`
	Memory   *struct{ M uint }   `msg:"Memory,omitempty"`
	WTime    *WTimeMsg           `msg:"WTime,omitempty"`
	Capacity *struct{ V int }    `msg:"Capacity,omitempty"`
}

func (*PossibleRes) DecodeMsg

func (z *PossibleRes) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PossibleRes) EncodeMsg

func (z *PossibleRes) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PossibleRes) MarshalMsg

func (z *PossibleRes) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PossibleRes) Msgsize

func (z *PossibleRes) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PossibleRes) UnmarshalMsg

func (z *PossibleRes) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Remote

type Remote struct {
	*RemoteBase
	// contains filtered or unexported fields
}

A Remote sends functions to its worker and watch for their results

type RemoteBase

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

type Resource

type Resource interface {
	Alloc(Resource) (Resource, bool)
	Dealloc(Resource)
	String() string
	Name() string
	Stat() (uint, uint)
}

func ResFromMsg

func ResFromMsg(rmsg *PossibleRes) Resource

type ResourceManager

type ResourceManager interface {
	// contains filtered or unexported methods
}

type ResultMsg

type ResultMsg struct {
	Tid       uint   `msg:"tid"`
	Exception string `msg:"exception"`
	// Usually store the pickled execution result / exception;
	// when as a rstatus stub, this stores the name (string) of the sworker instance.
	Result msgp.Raw `msg:"result"`
}

func (*ResultMsg) DecodeMsg

func (z *ResultMsg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ResultMsg) EncodeMsg

func (z *ResultMsg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ResultMsg) MarshalMsg

func (z *ResultMsg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ResultMsg) Msgsize

func (z *ResultMsg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ResultMsg) UnmarshalMsg

func (z *ResultMsg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SpecializedRemote

type SpecializedRemote struct {
	*RemoteBase
	// contains filtered or unexported fields
}

type SpecializedStager

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

Manage all channels for the specialized remotes' approval-rstatus workflow and all feedbackRemote instances

func NewSpecializedStager

func NewSpecializedStager() *SpecializedStager

func (*SpecializedStager) AddFeedbackRemote

func (s *SpecializedStager) AddFeedbackRemote(id uint, conn net.Conn, importTid tidImportFn)

func (*SpecializedStager) RemoveFeedbackRemote

func (s *SpecializedStager) RemoveFeedbackRemote(id uint)

func (*SpecializedStager) Run

func (s *SpecializedStager) Run(ctx context.Context, exportTid tidExportFn)

func (*SpecializedStager) SendSynAck

func (s *SpecializedStager) SendSynAck(snd *msgp.Writer, id uint) (err error)

Inform frontend about its asociated ID

type Stat

type Stat struct {
	// contains filtered or unexported fields
}
var DefaultStat *Stat

func (*Stat) Log

func (s *Stat) Log()

func (*Stat) Reset

func (s *Stat) Reset() *Stat

type Strawman

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

func (*Strawman) Scale

func (s *Strawman) Scale(newN int)

type Task

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

Task is a function submitted with resource request

type WTimeMsg

type WTimeMsg struct {
	T         uint64
	SoftT     uint64 `msg:"softT"`
	Group     string `msg:"group"`
	Countdown bool   `msg:"countdown"`
}

func (*WTimeMsg) DecodeMsg

func (z *WTimeMsg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WTimeMsg) EncodeMsg

func (z *WTimeMsg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WTimeMsg) MarshalMsg

func (z *WTimeMsg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*WTimeMsg) Msgsize

func (z *WTimeMsg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WTimeMsg) UnmarshalMsg

func (z *WTimeMsg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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