deployprogress
This commit is contained in:
@ -31,9 +31,10 @@ import (
|
||||
)
|
||||
|
||||
type clientConfig struct {
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
RunNodeExporter bool `json:"run_node_exporter"`
|
||||
}
|
||||
|
||||
func loadClientConfig() (clientConfig, error) {
|
||||
@ -359,13 +360,29 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
||||
logger.Println(err)
|
||||
}
|
||||
} else {
|
||||
if err := hc.deploy(&dr); err == nil {
|
||||
hn, _ := os.Hostname()
|
||||
|
||||
if err := hc.deploy(&dr, func(dp *protos.DeployingProgress) {
|
||||
dp.Hostname = hn
|
||||
dp.Name = dr.Name
|
||||
dp.Version = dr.Version
|
||||
op.ReportDeployingProgress(ctx, dp)
|
||||
}); err == nil {
|
||||
prog := gatherDeployedPrograms(hc.config.StorageRoot, dr.Name)
|
||||
hc.deploys[dr.Name] = prog
|
||||
op.Refresh(ctx, hc.makeOperationQueryRequest())
|
||||
} else {
|
||||
logger.Println(err)
|
||||
}
|
||||
|
||||
op.ReportDeployingProgress(ctx, &protos.DeployingProgress{
|
||||
Hostname: hn,
|
||||
Name: dr.Name,
|
||||
Version: dr.Version,
|
||||
State: "done",
|
||||
Progress: 0,
|
||||
Total: 0,
|
||||
})
|
||||
}
|
||||
|
||||
case shared.Withdraw:
|
||||
@ -467,10 +484,15 @@ func (hc *houstonClient) Start() {
|
||||
}
|
||||
|
||||
reconnCount++
|
||||
|
||||
var err error
|
||||
dialContext, cancelDial := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
client, _ = grpc.DialContext(dialContext, hc.config.GrpcAddress, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
client, err = grpc.DialContext(dialContext, hc.config.GrpcAddress, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
cancelDial()
|
||||
if client != nil {
|
||||
|
||||
if err != nil {
|
||||
logger.Println("grpc.DialContext returns err :", err)
|
||||
} else if client != nil {
|
||||
reconnCount = 0
|
||||
logger.Println("grpc.DialContext succeeded")
|
||||
hc.clientChan <- client
|
||||
|
||||
Reference in New Issue
Block a user