本文整理汇总了Golang中github.com/mesos/mesos-go/mesosproto.SlaveInfo类的典型用法代码示例。如果您正苦于以下问题:Golang SlaveInfo类的具体用法?Golang SlaveInfo怎么用?Golang SlaveInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SlaveInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Reregistered
// Reregistered is called when the executor is successfully re-registered with the slave.
// This can happen when the slave fails over.
func (k *KubernetesExecutor) Reregistered(driver bindings.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
if k.isDone() {
return
}
log.Infof("Reregistered with slave %v\n", slaveInfo)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to reregister/transition to a connected state")
}
if slaveInfo != nil {
_, err := node.CreateOrUpdate(k.client, slaveInfo.GetHostname(), node.SlaveAttributesToLabels(slaveInfo.Attributes))
if err != nil {
log.Errorf("cannot update node labels: %v", err)
}
}
if slaveInfo != nil && k.nodeInfos != nil {
// make sure nodeInfos is not nil and send new NodeInfo
k.lock.Lock()
defer k.lock.Unlock()
if k.isDone() {
return
}
k.nodeInfos <- nodeInfo(slaveInfo, nil)
}
}
开发者ID:pologood,项目名称:kubernetes,代码行数:28,代码来源:executor.go
示例2: Registered
// Registered is called when the executor is successfully registered with the slave.
func (k *KubernetesExecutor) Registered(driver bindings.ExecutorDriver,
executorInfo *mesos.ExecutorInfo, frameworkInfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
if k.isDone() {
return
}
log.Infof("Executor %v of framework %v registered with slave %v\n",
executorInfo, frameworkInfo, slaveInfo)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to register/transition to a connected state")
}
if executorInfo != nil && executorInfo.Data != nil {
k.initializeStaticPodsSource(executorInfo.Data)
}
if slaveInfo != nil {
_, err := node.CreateOrUpdate(k.client, slaveInfo.GetHostname(), node.SlaveAttributesToLabels(slaveInfo.Attributes))
if err != nil {
log.Errorf("cannot update node labels: %v", err)
}
}
// emit an empty update to allow the mesos "source" to be marked as seen
k.lock.Lock()
defer k.lock.Unlock()
k.sendPodUpdate(&kubetypes.PodUpdate{
Pods: []*api.Pod{},
Op: kubetypes.SET,
})
if slaveInfo != nil && k.nodeInfos != nil {
k.nodeInfos <- nodeInfo(slaveInfo, executorInfo) // leave it behind the upper lock to avoid panics
}
}
开发者ID:pologood,项目名称:kubernetes,代码行数:35,代码来源:executor.go
示例3: Reregistered
func (exec *ExecutorCore) Reregistered(driver exec.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
exec.lock.Lock()
defer exec.lock.Unlock()
exec.Driver = driver
fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname())
exec.slaveInfo = slaveInfo
}
开发者ID:glickbot,项目名称:riak-mesos,代码行数:7,代码来源:executor.go
示例4: Registered
// Registered is called when the executor is successfully registered with the slave.
func (k *Executor) Registered(
driver bindings.ExecutorDriver,
executorInfo *mesos.ExecutorInfo,
frameworkInfo *mesos.FrameworkInfo,
slaveInfo *mesos.SlaveInfo,
) {
if k.isDone() {
return
}
log.Infof(
"Executor %v of framework %v registered with slave %v\n",
executorInfo, frameworkInfo, slaveInfo,
)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to register/transition to a connected state")
}
if executorInfo != nil && executorInfo.Data != nil {
err := k.initializeStaticPodsSource(slaveInfo.GetHostname(), executorInfo.Data)
if err != nil {
log.Errorf("failed to initialize static pod configuration: %v", err)
}
}
annotations, err := executorInfoToAnnotations(executorInfo)
if err != nil {
log.Errorf(
"cannot get node annotations from executor info %v error %v",
executorInfo, err,
)
}
if slaveInfo != nil {
_, err := node.CreateOrUpdate(
k.client,
slaveInfo.GetHostname(),
node.SlaveAttributesToLabels(slaveInfo.Attributes),
annotations,
)
if err != nil {
log.Errorf("cannot update node labels: %v", err)
}
}
// emit an empty update to allow the mesos "source" to be marked as seen
k.lock.Lock()
defer k.lock.Unlock()
k.sendPodsSnapshot()
if slaveInfo != nil && k.nodeInfos != nil {
k.nodeInfos <- nodeInfo(slaveInfo, executorInfo) // leave it behind the upper lock to avoid panics
}
}
开发者ID:robertabbott,项目名称:kubernetes,代码行数:57,代码来源:executor.go
示例5: Registered
func (exec *ExecutorCore) Registered(driver exec.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
exec.lock.Lock()
defer exec.lock.Unlock()
fmt.Println("Registered Executor on slave ", slaveInfo.GetHostname())
log.Info("Executor Info: ", execInfo)
log.Info("Slave Info: ", slaveInfo)
log.Info("Framework Info: ", fwinfo)
exec.slaveInfo = slaveInfo
exec.execInfo = execInfo
exec.fwInfo = fwinfo
}
开发者ID:glickbot,项目名称:riak-mesos,代码行数:11,代码来源:executor.go
示例6: Registered
// Registered is called when the executor is successfully registered with the slave.
func (k *Executor) Registered(
driver bindings.ExecutorDriver,
executorInfo *mesos.ExecutorInfo,
frameworkInfo *mesos.FrameworkInfo,
slaveInfo *mesos.SlaveInfo,
) {
if k.isDone() {
return
}
log.Infof(
"Executor %v of framework %v registered with slave %v\n",
executorInfo, frameworkInfo, slaveInfo,
)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to register/transition to a connected state")
}
k.initializeStaticPodsSource(executorInfo)
annotations, err := annotationsFor(executorInfo)
if err != nil {
log.Errorf(
"cannot get node annotations from executor info %v error %v",
executorInfo, err,
)
}
if slaveInfo != nil {
_, err := k.nodeAPI.createOrUpdate(
slaveInfo.GetHostname(),
node.SlaveAttributesToLabels(slaveInfo.Attributes),
annotations,
)
if err != nil {
log.Errorf("cannot update node labels: %v", err)
}
}
k.lock.Lock()
defer k.lock.Unlock()
if slaveInfo != nil && k.nodeInfos != nil {
k.nodeInfos <- nodeInfo(slaveInfo, executorInfo) // leave it behind the upper lock to avoid panics
}
}
开发者ID:ethernetdan,项目名称:kubernetes,代码行数:49,代码来源:executor.go
示例7: Reregistered
// Reregistered is called when the executor is successfully re-registered with the slave.
// This can happen when the slave fails over.
func (k *KubernetesExecutor) Reregistered(driver bindings.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
if k.isDone() {
return
}
log.Infof("Reregistered with slave %v\n", slaveInfo)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to reregister/transition to a connected state")
}
if slaveInfo != nil {
_, err := node.CreateOrUpdate(k.client, slaveInfo.GetHostname(), node.SlaveAttributesToLabels(slaveInfo.Attributes))
if err != nil {
log.Errorf("cannot update node labels: %v", err)
}
}
k.initialRegistration.Do(k.onInitialRegistration)
}
开发者ID:JingGe,项目名称:kubernetes,代码行数:20,代码来源:executor.go
示例8: nodeInfo
func nodeInfo(si *mesos.SlaveInfo, ei *mesos.ExecutorInfo) NodeInfo {
var executorCPU, executorMem float64
// get executor resources
if ei != nil {
for _, r := range ei.GetResources() {
if r == nil || r.GetType() != mesos.Value_SCALAR {
continue
}
switch r.GetName() {
case "cpus":
executorCPU += r.GetScalar().GetValue()
case "mem":
executorMem += r.GetScalar().GetValue()
}
}
}
// get resource capacity of the node
ni := NodeInfo{}
for _, r := range si.GetResources() {
if r == nil || r.GetType() != mesos.Value_SCALAR {
continue
}
switch r.GetName() {
case "cpus":
// We intentionally take the floor of executorCPU because cores are integers
// and we would loose a complete cpu here if the value is <1.
// TODO(sttts): switch to float64 when "Machine Allocables" are implemented
ni.Cores += int(r.GetScalar().GetValue())
case "mem":
ni.Mem += int64(r.GetScalar().GetValue()) * 1024 * 1024
}
}
// TODO(sttts): subtract executorCPU/Mem from static pod resources before subtracting them from the capacity
ni.Cores -= int(executorCPU)
ni.Mem -= int64(executorMem) * 1024 * 1024
return ni
}
开发者ID:johndmulhausen,项目名称:kubernetes,代码行数:42,代码来源:node.go
示例9: Reregistered
// Reregistered called when executor re-regitered to mesos master
func (runner *TaskRunner) Reregistered(driver executor.ExecutorDriver, slaveInfo *mesosproto.SlaveInfo) {
fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:icsnju,项目名称:apt-mesos,代码行数:4,代码来源:task_runner.go
示例10: Reregistered
func (mExecutor *migrationExecutor) Reregistered(driver executor.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:EMC-CMD,项目名称:test-framework,代码行数:3,代码来源:example_executor.go
示例11: Registered
// Registered called when executor registered to mesos master
func (runner *TaskRunner) Registered(driver executor.ExecutorDriver, execInfo *mesosproto.ExecutorInfo, fwinfo *mesosproto.FrameworkInfo, slaveInfo *mesosproto.SlaveInfo) {
fmt.Println("Registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:icsnju,项目名称:apt-mesos,代码行数:4,代码来源:task_runner.go
示例12: Registered
// mesos.Executor interface method.
// Invoked once the executor driver has been able to successfully connect with Mesos.
// Not used by HttpMirrorExecutor yet.
func (this *HttpMirrorExecutor) Registered(driver executor.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
log.Logger.Info("Registered Executor on slave %s", slaveInfo.GetHostname())
}
开发者ID:elodina,项目名称:syphon,代码行数:6,代码来源:executor.go
示例13: Reregistered
// Reregistered called when executor re-regitered to mesos master
func (builder *ImageBuilder) Reregistered(driver executor.ExecutorDriver, slaveInfo *mesosproto.SlaveInfo) {
fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:icsnju,项目名称:apt-mesos,代码行数:4,代码来源:image_builder.go
示例14: Registered
func (self *DatabaseExecutor) Registered(driver exec.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
log.Infoln("Registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:lionelg3,项目名称:Forbin,代码行数:3,代码来源:DatabaseExecutor.go
示例15: Reregistered
// mesos.Executor interface method.
// Invoked when the executor re-registers with a restarted slave.
func (this *HttpMirrorExecutor) Reregistered(driver executor.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
log.Logger.Info("Re-registered Executor on slave %s", slaveInfo.GetHostname())
}
开发者ID:elodina,项目名称:syphon,代码行数:5,代码来源:executor.go
示例16: Registered
func (e *Executor) Registered(driver executor.ExecutorDriver, executor *mesos.ExecutorInfo, framework *mesos.FrameworkInfo, slave *mesos.SlaveInfo) {
Logger.Infof("[Registered] framework: %s slave: %s", framework.GetId().GetValue(), slave.GetId().GetValue())
}
开发者ID:elodina,项目名称:stockpile,代码行数:3,代码来源:executor.go
示例17: Reregistered
func (e *Executor) Reregistered(driver executor.ExecutorDriver, slave *mesos.SlaveInfo) {
Logger.Infof("[Reregistered] slave: %s", slave.GetId().GetValue())
}
开发者ID:elodina,项目名称:stockpile,代码行数:3,代码来源:executor.go
示例18: Registered
func (mExecutor *migrationExecutor) Registered(driver executor.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
fmt.Println("Registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:EMC-CMD,项目名称:test-framework,代码行数:3,代码来源:example_executor.go
示例19: Registered
// mesos.Executor interface method.
// Invoked once the executor driver has been able to successfully connect with Mesos.
// Not used by TransformExecutor yet.
func (this *TransformExecutor) Registered(driver executor.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
fmt.Printf("Registered Executor on slave %s\n", slaveInfo.GetHostname())
}
开发者ID:stealthly,项目名称:edge-test,代码行数:6,代码来源:executor.go
示例20: Reregistered
func (exec *exampleExecutor) Reregistered(driver exec.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname())
}
开发者ID:cebufooddroid,项目名称:mesos-go,代码行数:3,代码来源:main.go
注:本文中的github.com/mesos/mesos-go/mesosproto.SlaveInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论