manager

package
v0.0.0-...-281381b Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2019 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MaxJobs int = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	sync.RWMutex

	Spec string //not used in manager, only for showing info

	Stats JobStats
	// contains filtered or unexported fields
}

func (*Job) GetCmd

func (j *Job) GetCmd() string

GetCmd returns job cmd

func (*Job) GetID

func (j *Job) GetID() int

GetID returns job ID

func (*Job) Run

func (j *Job) Run()

Run runs a Job on the manager and returns not waiting for process fininsh We could wait, but seems that external scheduler do not need this by now.

type JobStats

type JobStats struct {
	MeanRss  float64
	MaxRss   float64
	RssCount float64
}

JobStats represents Job execution stats

func (*JobStats) AddRss

func (js *JobStats) AddRss(maxRss int64)
func NewJobStats() *JobStats {
	return &JobStats{0, 0, 0}
}

AddRss calculates mean and max of the job, given Maxrss from a process

type Manager

type Manager struct {
	sync.RWMutex

	Jobs [MaxJobs]*Job
	// contains filtered or unexported fields
}

Manager represent a process Manager

func New

func New() *Manager

New return a new process manager

func (*Manager) CreateJob

func (m *Manager) CreateJob(cmd, spec, shell string) (j *Job, err error)

CreateJob creates a new manager.Job from a command string

func (*Manager) PrintStats

func (m *Manager) PrintStats()

func (*Manager) Start

func (m *Manager) Start()

Start manager service. Receives Jobs on channel Receiver

Jump to

Keyboard shortcuts

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