worker

package
v0.9.68 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: BSD-2-Clause Imports: 35 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ID_HEARTBEATER    = 0
	ID_WORKSTEALER    = 1
	ID_DATADOWNLOADER = 2
	ID_WORKER         = 3
	ID_DELIVERER      = 4
	ID_REDISTRIBUTOR  = 5
	ID_DISCARDED      = 6 // flag acts as a message
)

Variables

View Source
var (
	FromStealer chan *core.Workunit // workStealer -> dataMover

	//workmap       map[string]int //workunit map [work_id]stage_id}
	Client_mode string
)

Functions

func CheckoutTokenByJobId

func CheckoutTokenByJobId(jobid string) (token string, err error)

func CheckoutWorkunitRemote

func CheckoutWorkunitRemote() (workunit *core.Workunit, err error)

func CleanDisk

func CleanDisk() (err error)

func ComposeProfile

func ComposeProfile() (profile *core.Client, err error)

invoked only once on start of awe-worker

func CreateContainer added in v0.9.13

func CreateContainer(create_args []string) (container_id string, err error)

func DiscardWorkunit

func DiscardWorkunit(id core.Workunit_Unique_Identifier) (err error)

func DockerizeName added in v0.9.33

func DockerizeName(input string) string

func FetchDataTokenByWorkId

func FetchDataTokenByWorkId(workid string) (token string, err error)

func FetchPrivateEnvByWorkId added in v0.9.3

func FetchPrivateEnvByWorkId(workid string) (envs map[string]string, err error)

func InitWorkers

func InitWorkers()

func InspectImage added in v0.9.13

func InspectImage(client *docker.Client, dockerimage_id string) (image *docker.Image, err error)

func KillContainer added in v0.9.13

func KillContainer(container_id string) (err error)

func ParseWorkunitArgs

func ParseWorkunitArgs(work *core.Workunit) (err error)

parse workunit, fetch input data, compose command arguments

func ReRegisterWithSelf

func ReRegisterWithSelf(host string) (err error)

func RegisterWithAuth

func RegisterWithAuth(host string, pclient *core.Client) (err error)

invoked on start of AWE worker AND on ReRegisterWithSelf

func RegisterWithProfile

func RegisterWithProfile(host string, profile *core.Client) (client *core.Client, err error)

not used, deprecated ?

func RemoveContainer added in v0.9.13

func RemoveContainer(container_id string) (err error)

func RemoveOldAWEContainers added in v0.9.3

func RemoveOldAWEContainers(client *docker.Client, container_name string) (err error)

func RestartClient

func RestartClient() (err error)

func RunCommand added in v0.9.13

func RunCommand(name string, arg ...string) (stdo []byte, stde []byte, err error)

execute command, wait, and return stdout and stderr ; do not use for large outputs ! it returns both stdout and stderr

func RunContainer added in v0.9.13

func RunContainer(run_args []string) (container_id string, err error)

** not tested **

func RunWorkunit

func RunWorkunit(workunit *core.Workunit) (pstats *core.WorkPerf, err error)

func RunWorkunitDirect

func RunWorkunitDirect(workunit *core.Workunit) (pstats *core.WorkPerf, err error)

func RunWorkunitDocker

func RunWorkunitDocker(workunit *core.Workunit) (pstats *core.WorkPerf, err error)

func SendHeartBeat

func SendHeartBeat() (err error)

client sends heartbeat to server to maintain active status and re-register when needed

func SetEnv

func SetEnv(workunit *core.Workunit) (envkeys []string, err error)

func Set_Metadata added in v0.9.33

func Set_Metadata(profile *core.Client)

func SplitDockerimageName added in v0.9.33

func SplitDockerimageName(Dockerimage string) (repository string, tag string, err error)

func StartClientWorkers

func StartClientWorkers()

func StartContainer added in v0.9.13

func StartContainer(container_id string, args string) (err error)

func StartProxyWorkers

func StartProxyWorkers()

func StopClient

func StopClient() (err error)

func SubmitWorkProxy

func SubmitWorkProxy(work *core.Workunit) (err error)

func TagImage added in v0.9.13

func TagImage(client *docker.Client, dockerimage_id string, tag_opts docker.TagImageOptions) (err error)

func UnSetEnv

func UnSetEnv(envkeys []string)

func WaitContainer added in v0.9.13

func WaitContainer(container_id string) (status int, err error)

Types

type ClientResponse

type ClientResponse struct {
	Code int         `bson:"status" json:"status"`
	Data core.Client `bson:"data" json:"data"`
	Errs []string    `bson:"error" json:"error"`
}

type DockerImageAttributes added in v0.9.13

type DockerImageAttributes struct {
	Name       string `bson:"name" json:"name"`
	Tag        string `bson:"tag" json:"tag"`
	Repository string `bson:"repository" json:"repository"`
}

type DockerShockNode added in v0.9.13

type DockerShockNode struct {
	shock.ShockNode
	Version    []int
	Attributes DockerImageAttributes
}

type DockerShockNodeArray added in v0.9.13

type DockerShockNodeArray []DockerShockNode

func (DockerShockNodeArray) Len added in v0.9.13

func (a DockerShockNodeArray) Len() int

func (DockerShockNodeArray) Less added in v0.9.13

func (a DockerShockNodeArray) Less(i, j int) bool

func (DockerShockNodeArray) Swap added in v0.9.13

func (a DockerShockNodeArray) Swap(i, j int)

type HeartbeatResponse

type HeartbeatResponse struct {
	Code int                        `bson:"status" json:"status"`
	Data core.HeartbeatInstructions `bson:"data" json:"data"`
	Errs []string                   `bson:"error" json:"error"`
}

type Mediumwork added in v0.9.48

type Mediumwork struct {
	Workunit *core.Workunit
}

type Openstack_Metadata added in v0.9.45

type Openstack_Metadata struct {
	Random_seed       string                   `bson:"random_seed" json:"random_seed"`
	Uuid              string                   `bson:"uuid" json:"uuid"`
	Availability_zone string                   `bson:"availability_zone" json:"availability_zone"`
	Hostname          string                   `bson:"hostname" json:"hostname"`
	Project_id        string                   `bson:"project_id" json:"project_id"`
	Meta              *Openstack_Metadata_meta `bson:"meta" json:"meta"`
}

curl http://169.254.169.254/openstack/2015-10-15/meta_data.json | jq '.' documentation: https://docs.openstack.org/admin-guide/compute-networking-nova.html TODO use this!

type Openstack_Metadata_meta added in v0.9.45

type Openstack_Metadata_meta struct {
	Priority string `bson:"priority" json:"priority"`
	Role     string `bson:"role" json:"role"`
	Name     string `bson:"name" json:"name"`
}

type Shock_Dockerimage_attributes added in v0.9.4

type Shock_Dockerimage_attributes struct {
	Id          string `bson:"id" json:"id"`                       // this is docker image id, not Shock id
	Name        string `bson:"name" json:"name"`                   // docker image name
	Type        string `bson:"type" json:"type"`                   // should be "dockerimage"
	BaseImageId string `bson:"base_image_id" json:"base_image_id"` // could used to reference parent image
}

type TokenResponse

type TokenResponse struct {
	Code int      `bson:"status" json:"status"`
	Data string   `bson:"data" json:"data"`
	Errs []string `bson:"error" json:"error"`
}

type WaitContainerResult added in v0.9.33

type WaitContainerResult struct {
	Error  error
	Status int
}

type WorkMap added in v0.9.33

type WorkMap struct {
	core.RWMutex
	// contains filtered or unexported fields
}

func NewWorkMap added in v0.9.33

func NewWorkMap() *WorkMap

func (*WorkMap) Delete added in v0.9.33

func (this *WorkMap) Delete(id core.Workunit_Unique_Identifier) (err error)

func (*WorkMap) Get added in v0.9.33

func (this *WorkMap) Get(id core.Workunit_Unique_Identifier) (value int, ok bool, err error)

func (*WorkMap) GetKeys added in v0.9.33

func (this *WorkMap) GetKeys() (value []core.Workunit_Unique_Identifier, err error)

func (*WorkMap) Set added in v0.9.33

func (this *WorkMap) Set(id core.Workunit_Unique_Identifier, value int, name string) (err error)

type WorkResponse

type WorkResponse struct {
	core.BaseResponse `bson:",inline" json:",inline" mapstructure:",squash"`
	Data              *core.Workunit `bson:"data" json:"data" mapstructure:"data"`
}

Jump to

Keyboard shortcuts

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