incompleted cm

This commit is contained in:
snoop 2017-04-15 20:16:14 +09:00
parent c91b5df21f
commit 5c617fe5fa
3 changed files with 20 additions and 16 deletions

View File

@ -110,9 +110,9 @@ func callRemove(container *string, crawlerName *string, id *string) {
}
func callStatus(container string) bool {
func callStatus(container *string) bool {
port := GetInstance().portMap[container]
port := GetInstance().portMap[*container]
if port == "" {
return false

View File

@ -48,7 +48,7 @@ func GetInstance() *CrawlerManager {
func (c *CrawlerManager)GetClient(container string,port string) (*grpc.ClientConn, error) {
b := c.checkContainer(container)
b := c.checkContainer(&container)
if b == false {
//c.runContainer(&container)
//CallInit()
@ -88,9 +88,6 @@ func (c *CrawlerManager)init() {
cs := c.isStartContainer()
//var cpm map[string][]string = make(map[string][]string)
//var ccl []string
for _, cc := range cs {
err := c.runAndInitContainer(&cc)
@ -100,14 +97,6 @@ func (c *CrawlerManager)init() {
continue
}
//existConfigFileDir(ConfigFolder, cc, &ccl)
//cpm[cc] = ccl
//err := c.runContainer(&cc)
//if err != nil {
// callInit(cc, &ccl)
//}
}
}
@ -131,7 +120,7 @@ func (c *CrawlerManager)isStartContainer() []string {
return cs
}
func (c *CrawlerManager)checkContainer(container string) bool {
func (c *CrawlerManager)checkContainer(container *string) bool {
return callStatus(container)
}
@ -185,7 +174,10 @@ func (c *CrawlerManager)runAndInitContainer(container *string) error {
func (c *CrawlerManager)runContainer(container *string) error {
//chekc is Run?
b := c.checkContainer(container)
if b {
return nil
}
cmdStr := getRunCommand(container)
@ -223,6 +215,7 @@ func (c *CrawlerManager)runContainer(container *string) error {
return nil
}
func (c *CrawlerManager)stopContainerAll() {
for k, _ := range c.pidMap {

View File

@ -236,4 +236,15 @@ func TestCallRemove22(t *testing.T) {
GetInstance().stopContainer(&c)
}
func TestRunRun(t *testing.T) {
c := "java"
GetInstance().runContainer(&c)
GetInstance().runContainer(&c)
GetInstance().runContainer(&c)
//GetInstance().stopContainer(&c)
}