api

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Data structures used to exchange information and requests over the http interface to mrp and similar tools.

Index

Constants

View Source
const (
	// Gets top-level information about a pipestance.
	QueryGetInfo = "/api/get-info"

	// Gets top-level information about a pipestance and all of its nodes.
	QueryGetState = "/api/get-state"

	// Gets information about a pipestance's performance.
	QueryGetPerf = "/api/get-perf"

	// Get the contents of a specific metadata file.
	QueryGetMetadata = "/api/get-metadata"

	// Restarts a failed pipestance.
	QueryRestart = "/api/restart"

	// Get the contents of a pipestance's top-level metadata.
	QueryGetMetadataTop = "/api/get-metadata-top/"

	// Terminate a running pipestance.
	QueryKill = "/api/kill"

	// Register an instance of mrp with an mrv host.
	QueryRegisterMrv = "/register"

	// Register (or re-register) an instance of mrp with an Enterprise host.
	QueryRegisterEnterprise = "/api/register"
)

Variables

This section is empty.

Functions

func EnableDebug

func EnableDebug(sm *http.ServeMux, verifyAuth AuthFunction)

Enables debugging endpoints for profiling and getting stack traces on a running instance. See `go doc net/http/pprof`. The difference is this doesn't rely on the default ServeMux.

In addition to the standard pprof endpoints, the /debug/enable_profile endpoint allows remotely enabling the mutex and blocking profiling. Posting to /debug/enable_profile?block=N&mutex=M sets the rates as given (see runtime.SetBlockProfileRate and runtime.SetMutexProfileFraction) If verifyAuth is non-null, it will be called and must return true before allowing the call is allowed to proceed.

Types

type AuthFunction

type AuthFunction func(http.ResponseWriter, *http.Request) bool

A function which should return true if authorization succeeds, and should write an error to the response and return false otherwise.

type GraphPage

type GraphPage struct {
	InstanceName string
	Container    string
	Pname        string
	Psid         string
	Admin        bool
	AdminStyle   bool
	Release      bool
	Auth         string
}

Information needed to process the graph web page template.

type MetadataForm

type MetadataForm struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

Information requred to query metadata for a specific pipestance.

type PerfInfo

type PerfInfo struct {
	Nodes []*core.NodePerfInfo `json:"nodes"`
}

All of the performance information for a pipestance.

type PipestanceInfo

type PipestanceInfo struct {
	// The name of the host where MRP is running.
	Hostname string `json:"hostname"`

	// The username of the user running MRP.
	Username string `json:"username"`

	// MRP's working directory.
	Cwd string `json:"cwd"`

	// The path to the mrp executable.
	Binpath string `json:"binpath"`

	// The command line used to execute mrp.
	Cmdline string `json:"cmdline"`

	// The PID of the MRP instance.
	Pid int `json:"pid"`

	// The time when the pipestance was first started.
	Start string `json:"start"`

	// The martian version for this mrp.
	Version      string             `json:"version"`
	Pname        string             `json:"pname"`
	PsId         string             `json:"psid"`
	State        core.MetadataState `json:"state"`
	JobMode      string             `json:"jobmode"`
	MaxCores     int                `json:"maxcores"`
	MaxMemGB     int                `json:"maxmemgb"`
	InvokePath   string             `json:"invokepath"`
	InvokeSource string             `json:"invokesrc,omitempty"`
	MroPath      string             `json:"mropath"`
	ProfileMode  core.ProfileMode   `json:"mroprofile"`
	Port         string             `json:"mroport"`
	MroVersion   string             `json:"mroversion"`
	Uuid         string             `json:"uuid"`
	PsPath       string             `json:"pipestance_path,omitempty"`

	// The reason for the most recent pipestance failure, if any.
	LastErrorMessage string `json:"err_msg,omitempty"`
}

Stores information about a pipestance which might be interesting to a user, or useful for a tool to query.

func ParsePipestanceInfoForm

func ParsePipestanceInfoForm(form url.Values) (PipestanceInfo, error)

Convert url form fields to a PipestanceInfo.

func (*PipestanceInfo) AsForm

func (self *PipestanceInfo) AsForm() url.Values

Serialize this object as a url form.

func (*PipestanceInfo) FullPipestancePath

func (self *PipestanceInfo) FullPipestancePath() string

Get the absoulte path to the pipestance directory

func (*PipestanceInfo) StripMro

func (self *PipestanceInfo) StripMro() *PipestanceInfo

Gets a shallow copy of this object with the InvokeSource omitted.

type PipestanceState

type PipestanceState struct {
	Nodes []*core.NodeInfo `json:"nodes"`
	Info  *PipestanceInfo  `json:"info"`
}

The full state information for a pipestance, including the status of every node in the pipeline graph.

Jump to

Keyboard shortcuts

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