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
- Variables
- func And(rs ...Resource) *multiResource
- func Capacity(v0 int) *capacity
- func Cores(n0 interface{}) *cores
- func Memory(m0 uint) *memory
- func MultiResource(rs []Resource) *multiResource
- func StatLoop()
- func WTime(t, softT uint64, group string, countdown bool) *wtime
- type ControlMsg
- type FnMsg
- type GrainExecutor
- type GrainManager
- type IRemote
- type PossibleRes
- type Remote
- type RemoteBase
- type Resource
- type ResourceManager
- type ResultMsg
- type SpecializedRemote
- type SpecializedStager
- func (s *SpecializedStager) AddFeedbackRemote(id uint, conn net.Conn, importTid tidImportFn)
- func (s *SpecializedStager) RemoveFeedbackRemote(id uint)
- func (s *SpecializedStager) Run(ctx context.Context, exportTid tidExportFn)
- func (s *SpecializedStager) SendSynAck(snd *msgp.Writer, id uint) (err error)
- type Stat
- type Strawman
- type Task
- type WTimeMsg
Constants ¶
const ( CMD_REG mgrCMD = iota CMD_UNR CMD_TRM CMD_STA CMD_CAN )
const ( FULL_HEALTH = 3 HEARTBEAT_INTERVAL = 10 * time.Second HEARTBEAT_TOLERANCE = 3 )
const ( TIMESTAT_NSAMPLE = 8 MAXDURATION = 100 * 365 * 24 * time.Hour )
const STATSPAN = 15 * time.Minute
const STRAWMANSPAN = 30 * time.Minute
Variables ¶
var TIMEDUR = regexp.MustCompile(`(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)`)
Functions ¶
func MultiResource ¶
func MultiResource(rs []Resource) *multiResource
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) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
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 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) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
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) ResetAndLog ¶
func (s *Stat) ResetAndLog()
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) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler