本文整理汇总了Golang中github.com/mesos/mesos-go/mesosproto.FrameworkInfo类的典型用法代码示例。如果您正苦于以下问题:Golang FrameworkInfo类的具体用法?Golang FrameworkInfo怎么用?Golang FrameworkInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrameworkInfo类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: registerOnce
// registerOnce returns true if we should attempt another registration later; it is *not*
// guarded by eventLock: all access to mutable members of MesosSchedulerDriver should be
// explicitly synchronized.
func (driver *MesosSchedulerDriver) registerOnce() bool {
var (
failover bool
pid *upid.UPID
info *mesos.FrameworkInfo
)
if func() bool {
driver.eventLock.RLock()
defer driver.eventLock.RUnlock()
if driver.stopped() || driver.connected || driver.masterPid == nil || (driver.credential != nil && !driver.authenticated) {
log.V(1).Infof("skipping registration request: stopped=%v, connected=%v, authenticated=%v",
driver.stopped(), driver.connected, driver.authenticated)
return false
}
failover = driver.failover
pid = driver.masterPid
info = proto.Clone(driver.frameworkInfo).(*mesos.FrameworkInfo)
return true
}() {
// register framework
var message proto.Message
if len(info.GetId().GetValue()) > 0 {
// not the first time, or failing over
log.V(1).Infof("Reregistering with master: %v", pid)
message = &mesos.ReregisterFrameworkMessage{
Framework: info,
Failover: proto.Bool(failover),
}
fmt.Printf("Reregistering with master: %v\nwith message:\n%v\n", pid, message)
} else {
log.V(1).Infof("Registering with master: %v", pid)
message = &mesos.RegisterFrameworkMessage{
Framework: info,
}
fmt.Printf("Reregistering with master: %v\nwith message:\n%v\n", pid, message)
}
if err := driver.send(pid, message); err != nil {
log.Errorf("failed to send RegisterFramework message: %v", err)
if _, err = driver.Stop(failover); err != nil {
log.Errorf("failed to stop scheduler driver: %v", err)
}
}
return true
}
return false
}
开发者ID:ilackarms,项目名称:mesos-go,代码行数:50,代码来源:scheduler.go
示例2: prepateCredentials
// create credentials data structure
func prepateCredentials(fwinfo *mesos.FrameworkInfo) *mesos.Credential {
if *mesosAuthPrincipal != "" {
fwinfo.Principal = proto.String(*mesosAuthPrincipal)
secret, err := ioutil.ReadFile(*mesosAuthSecretFile)
if err != nil {
log.Fatal(err)
}
return &mesos.Credential{
Principal: proto.String(*mesosAuthPrincipal),
Secret: secret,
}
} else {
return nil
}
}
开发者ID:felixb,项目名称:none,代码行数:16,代码来源:main.go
示例3: cred
func cred(fwinfo *mesos.FrameworkInfo) *mesos.Credential {
cred := (*mesos.Credential)(nil)
mesosAuthPrincipal := config.Runonce.AuthPrincipal
if mesosAuthPrincipal != "" {
fwinfo.Principal = proto.String(mesosAuthPrincipal)
cred = &mesos.Credential{
Principal: proto.String(mesosAuthPrincipal),
}
mesosAuthSecretFile := config.Runonce.AuthSecretFile
if mesosAuthSecretFile != "" {
_, err := os.Stat(mesosAuthSecretFile)
if err != nil {
log.Exit("missing secret file: ", err.Error())
}
secret, err := ioutil.ReadFile(mesosAuthSecretFile)
if err != nil {
log.Exit("failed to read secret file: ", err.Error())
}
cred.Secret = proto.String(strings.TrimSuffix(string(secret), "\n"))
}
}
return cred
}
开发者ID:yp-engineering,项目名称:mesos-runonce,代码行数:23,代码来源:main.go
示例4: 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
注:本文中的github.com/mesos/mesos-go/mesosproto.FrameworkInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论