processes

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Generated source file. Edit files in 'src' folder

Index

Constants

View Source
const (
	STDIN_CLOSE      = iota
	STDIN_TO_MANAGER = iota
)
View Source
const (
	STDOUT_CLOSE      = iota
	STDOUT_TO_LOGGER  = iota
	STDOUT_TO_MANAGER = iota
)
View Source
const (
	STDERR_CLOSE      = iota
	STDERR_TO_LOGGER  = iota
	STDERR_TO_MANAGER = iota
)
View Source
const (
	PROCESS_STARTED = 0x1
	PROCESS_READY   = 0x2
	PROCESS_DIED    = 0x4
)
View Source
const (
	//	JOB_STATUS_UNSET = iota  // zero should be the unset
	NEVER_RAN        = iota
	RUNNING          = iota
	STOPPED          = iota
	WAITING_FOR_DEPS = iota
	STARTING         = iota
	STOPPING         = iota
	RESTARTING       = iota
	FAILED           = iota
)

enum JOB_STATUS

View Source
const (
	CONTAINERERROR_UNKNOWN   = iota
	CONTAINERERROR_DUPLICATE = iota
)
View Source
const (
	JOBERROR_UNKNOWN                    = iota
	JOBERROR_NOT_FOUND                  = iota // don't have a job by that name
	JOBERROR_DUPLICATE_JOB              = iota
	JOBERROR_MISSING_DEPENDENCY         = iota
	JOBERROR_DEPENDENCY_FAILURE         = iota
	JOBERROR_MISSING_CONTAINER_TEMPLATE = iota
	JOBERROR_INVALID_CONFIG             = iota // config options don't make sense
	JOBERROR_INTERNAL_ERROR             = iota // catch all for things which should just not happen
)
View Source
const (
	EPOLLET        = 1 << 31
	MaxEpollEvents = 32
)
View Source
const (
	EFD_SEMAPHORE = 00000001
	EFD_CLOEXEC   = 02000000
	EFD_NONBLOCK  = 00004000
)

Variables

View Source
var PROCESS_STATES = map[uint32]string{
	0:               "unknown",
	PROCESS_STARTED: "started",
	PROCESS_READY:   "ready",
	PROCESS_DIED:    "died",
}
View Source
var THIS_DIR string

Functions

func ExecFile

func ExecFile(path string, args []string, env []string, opts *ExecFileOpts) (pid int, errno int)

func ForEachTrackedProcess

func ForEachTrackedProcess(cb func(int, *ProcessRecord))

func InitProcessEvents

func InitProcessEvents(config maestroSpecs.StatsConfig)

called after config file is read

func InitProcessMgmt

func InitProcessMgmt(config *configs.ProcessesConfig)

func InitProcessSubsystem

func InitProcessSubsystem(maxevent uint32)

func IsJobActive

func IsJobActive(jobname string) (status bool, pid int)

Returns true, pid if the job specified by jobname is active

func New_processEventFIFO

func New_processEventFIFO(maxsize uint32) (ret *processEventFIFO)

func ReapChildren

func ReapChildren() (ret int, status unix.WaitStatus)

attempts to reap a child, but does not block a valid PID is returned if a reap happened, otherwise 0

func RegisterContainer

func RegisterContainer(cont maestroSpecs.ContainerTemplate) (err error)

func RegisterJob

func RegisterJob(job maestroSpecs.JobDefinition) (err error)

func RegisterJobOverwrite

func RegisterJobOverwrite(job maestroSpecs.JobDefinition) (err error)

func RegisterMutableJob

func RegisterMutableJob(job maestroSpecs.JobDefinition) (err error)

func RestartJob

func RestartJob(name string) (errout error)

func StartAllAutoStartJobs

func StartAllAutoStartJobs()

func StartEventsMonitor

func StartEventsMonitor()

func StartJob

func StartJob(name string) (errout error)

func StopEventsMonitor

func StopEventsMonitor()

func SubmitEvent

func SubmitEvent(ev Event)

func TrackNewProcessByPid

func TrackNewProcessByPid(pid int) (ret *ProcessRecord, old *ProcessRecord)

creates a new ProcessRecord, stores it in the tracking map, and returns this new one the old one - if for some rare reason a process with the same PID was already there

func ValidateJobs

func ValidateJobs() error

Types

type ContainerError

type ContainerError struct {
	ContainerName string
	Code          int
	Aux           string
}

func (*ContainerError) Error

func (this *ContainerError) Error() string

type Event

type Event interface {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON(b []byte) error
}

func GetLastLocalEvents

func GetLastLocalEvents(max uint32) (ret []*Event)

func GetLastUpstreamEvents

func GetLastUpstreamEvents(max uint32) (ret []*Event)

type EventList

type EventList struct {
	Events []*Event `json:"events"`
}

type ExecFileOpts

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

func NewExecFileOpts

func NewExecFileOpts(jobname string, compid string) (opts *ExecFileOpts)

func (*ExecFileOpts) GetOriginLabelId

func (opts *ExecFileOpts) GetOriginLabelId() uint32

func (*ExecFileOpts) GetStderrFd

func (opts *ExecFileOpts) GetStderrFd() (ret int)

func (*ExecFileOpts) GetStdoutFd

func (opts *ExecFileOpts) GetStdoutFd() (ret int)

func (*ExecFileOpts) SetJobName

func (opts *ExecFileOpts) SetJobName(name string)

func (*ExecFileOpts) SetMessageString

func (opts *ExecFileOpts) SetMessageString(msg string)

func (*ExecFileOpts) SetNewPgid

func (opts *ExecFileOpts) SetNewPgid()

func (*ExecFileOpts) SetNewSid

func (opts *ExecFileOpts) SetNewSid()

func (*ExecFileOpts) SetOkString

func (opts *ExecFileOpts) SetOkString(ok bool)

func (*ExecFileOpts) SetUsePgid

func (opts *ExecFileOpts) SetUsePgid(pid int)

type JobError

type JobError struct {
	JobName string
	Code    int
	Aux     string
}

func (*JobError) Error

func (this *JobError) Error() string

type JobStatusData

type JobStatusData interface {
	MarshalJSON() ([]byte, error)
}

func GetJobStatus

func GetJobStatus() (data JobStatusData, err error)

type MemStatEvent

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

func NewVirtualMemEvent

func NewVirtualMemEvent(stats *mem.VirtualMemoryStat) (ret *MemStatEvent)

func (MemStatEvent) MarshalJSON

func (this MemStatEvent) MarshalJSON() ([]byte, error)

func (MemStatEvent) UnmarshalJSON

func (this MemStatEvent) UnmarshalJSON(b []byte) error

type ProcessEvent

type ProcessEvent struct {
	Pid int `json:"pid"`

	// The PID may change on restart, but the job name remains the same
	Job     string `json:"job"`
	ExitVal int    `json:"exitVal"` // 0 if the process is not exited
	// contains filtered or unexported fields
}

func (ProcessEvent) MarshalJSON

func (this ProcessEvent) MarshalJSON() ([]byte, error)

func (ProcessEvent) UnmarshalJSON

func (this ProcessEvent) UnmarshalJSON(b []byte) error

type ProcessRecord

type ProcessRecord struct {
	Pid int
	// the Path to start the process executable
	Path string
	// serves as a generic identifier for a particular job
	// jobs maybe restarted, etc. A Job should be a unique name to the
	// instance of maestro on this gateway
	Job       string
	CompId    string
	Started   time.Time
	Stopped   time.Time
	State     uint32 // see PROCESS_STATES
	ExitValue int
}

a record of start and/or stop operation. basically a single life of a process (not a Job)

func GetTrackedProcessByPid

func GetTrackedProcessByPid(pid int) (ret *ProcessRecord, ok bool)

returns a ProcessRecord by its PID (process ID)

func RemoveTrackedProcessByPid

func RemoveTrackedProcessByPid(pid int) (ret *ProcessRecord)

type ProcessStatsConfig

type ProcessStatsConfig interface {
	GetInterval() uint32
	GetConfig_CheckMem() (uint32, bool)
}

type WakeupFd

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

func NewWakeupFd

func NewWakeupFd() (ret *WakeupFd, errno error)

Linux version:

func (*WakeupFd) ReadWakeup

func (this *WakeupFd) ReadWakeup() (ret uint64, errno error)

func (*WakeupFd) Wakeup

func (this *WakeupFd) Wakeup(val uint64) (errno error)

Jump to

Keyboard shortcuts

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