提交 52cf0b1e 编写于 作者: H hanxinke

atune: update output and log

上级 a914615f
...@@ -105,7 +105,7 @@ func doBeforeJob(ctx *cli.Context) error { ...@@ -105,7 +105,7 @@ func doBeforeJob(ctx *cli.Context) error {
cfg := config.NewCfg() cfg := config.NewCfg()
if err := cfg.Load(); err != nil { if err := cfg.Load(); err != nil {
log.Errorf("Faild to load config file, error: %v", err) log.Errorf("Faild to load config file, error: %v", err)
return fmt.Errorf("faild to load config file, error: %v", err) return fmt.Errorf("failed to load config file, error: %v", err)
} }
store := &sqlstore.Sqlstore{ store := &sqlstore.Sqlstore{
...@@ -123,7 +123,7 @@ func doBeforeJob(ctx *cli.Context) error { ...@@ -123,7 +123,7 @@ func doBeforeJob(ctx *cli.Context) error {
log.Infof("initializing service: %s", service.Name) log.Infof("initializing service: %s", service.Name)
service.Instance.Set(cfg) service.Instance.Set(cfg)
if err := service.Instance.Init(); err != nil { if err := service.Instance.Init(); err != nil {
return fmt.Errorf("service init faild: %v", err) return fmt.Errorf("service init failed: %v", err)
} }
} }
...@@ -138,7 +138,7 @@ func doBeforeJob(ctx *cli.Context) error { ...@@ -138,7 +138,7 @@ func doBeforeJob(ctx *cli.Context) error {
go func() { go func() {
err := backgroundService.Run() err := backgroundService.Run()
if err != nil { if err != nil {
log.Errorf("service %s running faild, reason: %v", service.Name, err) log.Errorf("service %s running failed, reason: %v", service.Name, err)
return return
} }
}() }()
...@@ -188,7 +188,7 @@ func runatuned(ctx *cli.Context) error { ...@@ -188,7 +188,7 @@ func runatuned(ctx *cli.Context) error {
} }
if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil { if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil {
log.Errorf("waiting for pyservice faild: %v", err) log.Errorf("waiting for pyservice failed: %v", err)
return err return err
} }
......
...@@ -128,7 +128,7 @@ func (c *Cfg) Load() error { ...@@ -128,7 +128,7 @@ func (c *Cfg) Load() error {
cfg, err := ini.Load(defaultConfigFile) cfg, err := ini.Load(defaultConfigFile)
if err != nil { if err != nil {
return fmt.Errorf("faild to parse %s, %v", defaultConfigFile, err) return fmt.Errorf("failed to parse %s, %v", defaultConfigFile, err)
} }
c.Raw = cfg c.Raw = cfg
......
...@@ -49,7 +49,7 @@ func InitLogger(modes []string, cfg *ini.File) error { ...@@ -49,7 +49,7 @@ func InitLogger(modes []string, cfg *ini.File) error {
case "syslog": case "syslog":
syslogHook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "atuned") syslogHook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "atuned")
if err != nil { if err != nil {
baseLogger.Errorf("syslog hook init faild:%v", err) baseLogger.Errorf("syslog hook init failed:%v", err)
} }
baseLogger.entry.Logger.AddHook(syslogHook) baseLogger.entry.Logger.AddHook(syslogHook)
} }
......
...@@ -48,7 +48,7 @@ func (c *Configurator) Put() (*RespConfigurator, error) { ...@@ -48,7 +48,7 @@ func (c *Configurator) Put() (*RespConfigurator, error) {
return nil, fmt.Errorf("section %s is not exist", c.Section) return nil, fmt.Errorf("section %s is not exist", c.Section)
} }
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -77,7 +77,7 @@ func (c *Configurator) Post() (*RespConfigurator, error) { ...@@ -77,7 +77,7 @@ func (c *Configurator) Post() (*RespConfigurator, error) {
return nil, fmt.Errorf("section %s is not exist", c.Section) return nil, fmt.Errorf("section %s is not exist", c.Section)
} }
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -106,7 +106,7 @@ func (c *Configurator) Get() (*RespConfigurator, error) { ...@@ -106,7 +106,7 @@ func (c *Configurator) Get() (*RespConfigurator, error) {
return nil, fmt.Errorf("section %s is not exist", c.Section) return nil, fmt.Errorf("section %s is not exist", c.Section)
} }
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
......
...@@ -48,7 +48,7 @@ func (m *MonitorBody) Get() (*MonitorGetResp, error) { ...@@ -48,7 +48,7 @@ func (m *MonitorBody) Get() (*MonitorGetResp, error) {
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to monitor service faild") return nil, fmt.Errorf("connect to monitor service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
...@@ -77,12 +77,12 @@ func MonitorGet(module string, purpose string, format string, path string, para ...@@ -77,12 +77,12 @@ func MonitorGet(module string, purpose string, format string, path string, para
respGetIns, err := monitorBody.Get() respGetIns, err := monitorBody.Get()
if err != nil { if err != nil {
log.Errorf("model monitor module %s get data faild: %v", module, err) log.Errorf("model monitor module %s get data failed: %v", module, err)
return "", err return "", err
} }
if respGetIns.Status != "OK" { if respGetIns.Status != "OK" {
log.Errorf("model monitor module %s get data faild, error: %s", module, respGetIns.Value) log.Errorf("model monitor module %s get data failed, error: %s", module, respGetIns.Value)
return "", fmt.Errorf(respGetIns.Value) return "", fmt.Errorf(respGetIns.Value)
} }
return respGetIns.Value, nil return respGetIns.Value, nil
......
...@@ -36,7 +36,7 @@ func (t *Training) Post() (bool, error) { ...@@ -36,7 +36,7 @@ func (t *Training) Post() (bool, error) {
defer response.Body.Close() defer response.Body.Close()
if response.StatusCode != 200 { if response.StatusCode != 200 {
return false, fmt.Errorf("training data faild") return false, fmt.Errorf("training data failed")
} }
return true, nil return true, nil
......
...@@ -165,7 +165,7 @@ func LoadFromWorkloadType(workloadType string) (Profile, bool) { ...@@ -165,7 +165,7 @@ func LoadFromWorkloadType(workloadType string) (Profile, bool) {
classProfile := &sqlstore.GetClass{Class: workloadType} classProfile := &sqlstore.GetClass{Class: workloadType}
err := sqlstore.GetClasses(classProfile) err := sqlstore.GetClasses(classProfile)
if err != nil { if err != nil {
log.Errorf("inquery class_profile table faild") log.Errorf("inquery class_profile table failed")
return Profile{}, false return Profile{}, false
} }
if len(classProfile.Result) == 0 { if len(classProfile.Result) == 0 {
......
...@@ -76,7 +76,7 @@ func (c *ConfigPutBody) Put() (*RespPut, error) { ...@@ -76,7 +76,7 @@ func (c *ConfigPutBody) Put() (*RespPut, error) {
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -101,7 +101,7 @@ func (c *ConfigPutBody) Post() (*RespPut, error) { ...@@ -101,7 +101,7 @@ func (c *ConfigPutBody) Post() (*RespPut, error) {
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -347,7 +347,7 @@ func (p *Profile) Check(ch chan *PB.AckCheck) error { ...@@ -347,7 +347,7 @@ func (p *Profile) Check(ch chan *PB.AckCheck) error {
for _, service := range services { for _, service := range services {
log.Infof("initializing checker service in profile check: %s", service.Name) log.Infof("initializing checker service in profile check: %s", service.Name)
if err := service.Instance.Init(); err != nil { if err := service.Instance.Init(); err != nil {
return fmt.Errorf("service init faild: %v", err) return fmt.Errorf("service init failed: %v", err)
} }
} }
...@@ -364,7 +364,7 @@ func (p *Profile) Check(ch chan *PB.AckCheck) error { ...@@ -364,7 +364,7 @@ func (p *Profile) Check(ch chan *PB.AckCheck) error {
} }
err := checkerService.Check(ch) err := checkerService.Check(ch)
if err != nil { if err != nil {
log.Errorf("service %s running faild, reason: %v", service.Name, err) log.Errorf("service %s running failed, reason: %v", service.Name, err)
continue continue
} }
} }
......
...@@ -57,7 +57,7 @@ func (p *HistoryProfile) Resume(ch chan *PB.AckCheck) error { ...@@ -57,7 +57,7 @@ func (p *HistoryProfile) Resume(ch chan *PB.AckCheck) error {
description := fmt.Sprintf("value: %s", key.Value()) description := fmt.Sprintf("value: %s", key.Value())
sendChanToAdm(ch, key.Name(), utils.SUCCESS, description) sendChanToAdm(ch, key.Name(), utils.SUCCESS, description)
} else { } else {
description := fmt.Sprintf("faild: %s", statusStr) description := fmt.Sprintf("failed: %s", statusStr)
sendChanToAdm(ch, key.Name(), utils.FAILD, description) sendChanToAdm(ch, key.Name(), utils.FAILD, description)
} }
} }
...@@ -80,7 +80,7 @@ func (p *HistoryProfile) Load(context string) error { ...@@ -80,7 +80,7 @@ func (p *HistoryProfile) Load(context string) error {
func Rollback() error { func Rollback() error {
profileLogs, err := sqlstore.GetProfileLogs() profileLogs, err := sqlstore.GetProfileLogs()
if err != nil { if err != nil {
log.Errorf("get profile history faild, %v", err) log.Errorf("get profile history failed, %v", err)
return err return err
} }
......
...@@ -87,13 +87,13 @@ func (y *YamlPrjCli) BenchMark() (string, error) { ...@@ -87,13 +87,13 @@ func (y *YamlPrjCli) BenchMark() (string, error) {
newScript := strings.Replace(evaluation.Info.Get, "$out", string(benchOutByte), -1) newScript := strings.Replace(evaluation.Info.Get, "$out", string(benchOutByte), -1)
bout, err := ExecCommand(newScript) bout, err := ExecCommand(newScript)
if err != nil { if err != nil {
err = fmt.Errorf("faild to exec %s, err: %v", newScript, err) err = fmt.Errorf("failed to exec %s, err: %v", newScript, err)
return strings.Join(benchStr, ","), err return strings.Join(benchStr, ","), err
} }
floatOut, err := strconv.ParseFloat(strings.Replace(string(bout), "\n", "", -1), 64) floatOut, err := strconv.ParseFloat(strings.Replace(string(bout), "\n", "", -1), 64)
if err != nil { if err != nil {
err = fmt.Errorf("faild to parse float, err: %v", err) err = fmt.Errorf("failed to parse float, err: %v", err)
return strings.Join(benchStr, ","), err return strings.Join(benchStr, ","), err
} }
...@@ -121,7 +121,7 @@ func (y *YamlPrjSvr) RunSet(optStr string) error { ...@@ -121,7 +121,7 @@ func (y *YamlPrjSvr) RunSet(optStr string) error {
for _, obj := range y.Object { for _, obj := range y.Object {
out, err := ExecCommand(obj.Info.GetScript) out, err := ExecCommand(obj.Info.GetScript)
if err != nil { if err != nil {
return fmt.Errorf("faild to exec %s, err: %v", obj.Info.GetScript, err) return fmt.Errorf("failed to exec %s, err: %v", obj.Info.GetScript, err)
} }
if strings.TrimSpace(string(out)) == paraMap[obj.Name] { if strings.TrimSpace(string(out)) == paraMap[obj.Name] {
...@@ -133,7 +133,7 @@ func (y *YamlPrjSvr) RunSet(optStr string) error { ...@@ -133,7 +133,7 @@ func (y *YamlPrjSvr) RunSet(optStr string) error {
log.Info("set script:", newScript) log.Info("set script:", newScript)
_, err = ExecCommand(newScript) _, err = ExecCommand(newScript)
if err != nil { if err != nil {
return fmt.Errorf("faild to exec %s, err: %v", newScript, err) return fmt.Errorf("failed to exec %s, err: %v", newScript, err)
} }
} }
return nil return nil
...@@ -155,13 +155,13 @@ func (y *YamlPrjSvr) RestartProject() error { ...@@ -155,13 +155,13 @@ func (y *YamlPrjSvr) RestartProject() error {
if needRestart { if needRestart {
out, err := ExecCommand(stopWorkload) out, err := ExecCommand(stopWorkload)
if err != nil { if err != nil {
return fmt.Errorf("faild to exec %s, err: %v", stopWorkload, err) return fmt.Errorf("failed to exec %s, err: %v", stopWorkload, err)
} }
log.Debug(string(out)) log.Debug(string(out))
out, err = ExecCommand(startWorkload) out, err = ExecCommand(startWorkload)
if err != nil { if err != nil {
return fmt.Errorf("faild to exec %s, err: %v", startWorkload, err) return fmt.Errorf("failed to exec %s, err: %v", startWorkload, err)
} }
log.Debug(string(out)) log.Debug(string(out))
} }
......
...@@ -60,7 +60,7 @@ func (c *ConfigPutBody) Put() (*RespPut, error) { ...@@ -60,7 +60,7 @@ func (c *ConfigPutBody) Put() (*RespPut, error) {
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -85,7 +85,7 @@ func (c *ConfigPutBody) Get() (*RespPut, error) { ...@@ -85,7 +85,7 @@ func (c *ConfigPutBody) Get() (*RespPut, error) {
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
return nil, fmt.Errorf("connect to configurator service faild") return nil, fmt.Errorf("connect to configurator service failed")
} }
resBody, err := ioutil.ReadAll(res.Body) resBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
...@@ -182,7 +182,7 @@ func (s *Scheduler) Active(ch chan *PB.AckCheck, itemKeys []string, items map[st ...@@ -182,7 +182,7 @@ func (s *Scheduler) Active(ch chan *PB.AckCheck, itemKeys []string, items map[st
for _, service := range services { for _, service := range services {
log.Infof("initializing checker service: %s", service.Name) log.Infof("initializing checker service: %s", service.Name)
if err := service.Instance.Init(); err != nil { if err := service.Instance.Init(); err != nil {
return fmt.Errorf("service init faild: %v", err) return fmt.Errorf("service init failed: %v", err)
} }
} }
...@@ -199,7 +199,7 @@ func (s *Scheduler) Active(ch chan *PB.AckCheck, itemKeys []string, items map[st ...@@ -199,7 +199,7 @@ func (s *Scheduler) Active(ch chan *PB.AckCheck, itemKeys []string, items map[st
} }
err := checkerService.Check(ch) err := checkerService.Check(ch)
if err != nil { if err != nil {
log.Errorf("service %s running faild, reason: %v", service.Name, err) log.Errorf("service %s running failed, reason: %v", service.Name, err)
continue continue
} }
} }
......
...@@ -49,7 +49,7 @@ func (m *Monitor) Set(cfg *config.Cfg) { ...@@ -49,7 +49,7 @@ func (m *Monitor) Set(cfg *config.Cfg) {
// Run method start the monitor service // Run method start the monitor service
func (m *Monitor) Run() error { func (m *Monitor) Run() error {
if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil { if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil {
log.Errorf("waiting for pyservice faild: %v", err) log.Errorf("waiting for pyservice failed: %v", err)
return err return err
} }
...@@ -85,7 +85,7 @@ func (m *Monitor) Run() error { ...@@ -85,7 +85,7 @@ func (m *Monitor) Run() error {
if _, err := models.MonitorGet(strings.ToUpper(modulePurpose[0]), if _, err := models.MonitorGet(strings.ToUpper(modulePurpose[0]),
strings.ToUpper(modulePurpose[1]), strings.ToUpper(modulePurpose[1]),
config.FileFormat, filename, ""); err != nil { config.FileFormat, filename, ""); err != nil {
log.Errorf("collect module %s faild, error: %v", module, err) log.Errorf("collect module %s failed, error: %v", module, err)
continue continue
} }
} }
......
...@@ -66,14 +66,14 @@ func (p *PyEngine) Run() error { ...@@ -66,14 +66,14 @@ func (p *PyEngine) Run() error {
err := cmd.Start() err := cmd.Start()
if err != nil { if err != nil {
log.Errorf("cmd.Start() analysis service faild: %v", err) log.Errorf("cmd.Start() analysis service failed: %v", err)
os.Exit(-1) os.Exit(-1)
} }
err = cmd.Wait() err = cmd.Wait()
if err != nil { if err != nil {
log.Errorf("cmd.Run() analysis faild with: %v", err) log.Errorf("cmd.Run() analysis failed with: %v", err)
os.Exit(-1) os.Exit(-1)
} }
......
...@@ -54,7 +54,7 @@ func (t *Timer) Set(cfg *config.Cfg) { ...@@ -54,7 +54,7 @@ func (t *Timer) Set(cfg *config.Cfg) {
func (t *Timer) Run() error { func (t *Timer) Run() error {
/* Static & Dynamic judge */ /* Static & Dynamic judge */
if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil { if err := utils.WaitForPyservice(config.LocalHost, config.RestPort); err != nil {
log.Errorf("waiting for pyservice faild: %v", err) log.Errorf("waiting for pyservice failed: %v", err)
return err return err
} }
......
...@@ -38,7 +38,7 @@ func (s *Sqlstore) Init() error { ...@@ -38,7 +38,7 @@ func (s *Sqlstore) Init() error {
err := os.MkdirAll(config.DatabasePath, 0750) err := os.MkdirAll(config.DatabasePath, 0750)
if err != nil { if err != nil {
return fmt.Errorf("faild to mkdir: %s(%v)", config.DatabasePath, err) return fmt.Errorf("failed to mkdir: %s(%v)", config.DatabasePath, err)
} }
dbName := path.Join(config.DatabasePath, config.DatabaseName) dbName := path.Join(config.DatabasePath, config.DatabaseName)
...@@ -48,7 +48,7 @@ func (s *Sqlstore) Init() error { ...@@ -48,7 +48,7 @@ func (s *Sqlstore) Init() error {
engine, err = xorm.NewEngine(config.DatabaseType, connStr) engine, err = xorm.NewEngine(config.DatabaseType, connStr)
if err != nil { if err != nil {
return fmt.Errorf("faild to connect to database: %v", err) return fmt.Errorf("failed to connect to database: %v", err)
} }
s.engine = engine s.engine = engine
...@@ -68,7 +68,7 @@ func Reload(path string) error { ...@@ -68,7 +68,7 @@ func Reload(path string) error {
log.Infof("Reload DB: %s", path) log.Infof("Reload DB: %s", path)
engine, err := xorm.NewEngine("sqlite3", connStr) engine, err := xorm.NewEngine("sqlite3", connStr)
if err != nil { if err != nil {
return fmt.Errorf("faild to connect to database: %v", err) return fmt.Errorf("failed to connect to database: %v", err)
} }
globalEngine = engine globalEngine = engine
......
...@@ -57,7 +57,7 @@ func (h *HprePostBody) Get() (*RespHprePost, error) { ...@@ -57,7 +57,7 @@ func (h *HprePostBody) Get() (*RespHprePost, error) {
fmt.Println(res.StatusCode) fmt.Println(res.StatusCode)
respBody, err := ioutil.ReadAll(res.Body) respBody, err := ioutil.ReadAll(res.Body)
fmt.Println(string(respBody), err) fmt.Println(string(respBody), err)
return nil, fmt.Errorf("get hpre support faild") return nil, fmt.Errorf("get hpre support failed")
} }
respBody, err := ioutil.ReadAll(res.Body) respBody, err := ioutil.ReadAll(res.Body)
...@@ -125,8 +125,8 @@ func IsSupportHpre() (bool, error) { ...@@ -125,8 +125,8 @@ func IsSupportHpre() (bool, error) {
} }
respGetIns, err := body.Get() respGetIns, err := body.Get()
if err != nil { if err != nil {
log.Infof("get support_hpre faild") log.Infof("get support_hpre failed")
return false, fmt.Errorf("get support_hpre faild") return false, fmt.Errorf("get support_hpre failed")
} }
if respGetIns.Value == "yes" { if respGetIns.Value == "yes" {
......
...@@ -93,7 +93,7 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck) error { ...@@ -93,7 +93,7 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck) error {
out, err := project.ExecCommand(item.Info.GetScript) out, err := project.ExecCommand(item.Info.GetScript)
if err != nil { if err != nil {
return fmt.Errorf("faild to exec %s, err: %v", item.Info.GetScript, err) return fmt.Errorf("failed to exec %s, err: %v", item.Info.GetScript, err)
} }
initConfigure = append(initConfigure, strings.TrimSpace(knob.Name+"="+string(out))) initConfigure = append(initConfigure, strings.TrimSpace(knob.Name+"="+string(out)))
} }
...@@ -265,7 +265,7 @@ func (o *Optimizer) evalParsing(ch chan *PB.AckCheck) (string, error) { ...@@ -265,7 +265,7 @@ func (o *Optimizer) evalParsing(ch chan *PB.AckCheck) (string, error) {
func deleteTask(url string) error { func deleteTask(url string) error {
resp, err := http.Delete(url) resp, err := http.Delete(url)
if err != nil { if err != nil {
log.Error("delete task faild:", err) log.Error("delete task failed:", err)
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
...@@ -279,7 +279,7 @@ func CheckServerPrj(data string, optimizer *Optimizer) error { ...@@ -279,7 +279,7 @@ func CheckServerPrj(data string, optimizer *Optimizer) error {
if !info.IsDir() { if !info.IsDir() {
prj := new(project.YamlPrjSvr) prj := new(project.YamlPrjSvr)
if err := utils.ParseFile(path, "yaml", &prj); err != nil { if err := utils.ParseFile(path, "yaml", &prj); err != nil {
return fmt.Errorf("load %s faild, err: %v", path, err) return fmt.Errorf("load %s failed, err: %v", path, err)
} }
log.Infof("project:%s load %s success", prj.Project, path) log.Infof("project:%s load %s success", prj.Project, path)
prjs = append(prjs, prj) prjs = append(prjs, prj)
......
...@@ -45,7 +45,7 @@ func (r *RuleBody) Post() (*map[string]interface{}, error) { ...@@ -45,7 +45,7 @@ func (r *RuleBody) Post() (*map[string]interface{}, error) {
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 { if res.StatusCode != 200 {
log.Errorf("URL: %s, response code: %d", url, res.StatusCode) log.Errorf("URL: %s, response code: %d", url, res.StatusCode)
return nil, fmt.Errorf("get monitor data faild, url: %s", url) return nil, fmt.Errorf("get monitor data failed, url: %s", url)
} }
respBody, err := ioutil.ReadAll(res.Body) respBody, err := ioutil.ReadAll(res.Body)
......
...@@ -78,7 +78,7 @@ func profileDefineCheck(ctx *cli.Context) error { ...@@ -78,7 +78,7 @@ func profileDefineCheck(ctx *cli.Context) error {
_, err = ini.Load(file) _, err = ini.Load(file)
if err != nil { if err != nil {
return fmt.Errorf("load profile faild, file format may be not correct") return fmt.Errorf("load profile failed, file format may be not correct")
} }
return nil return nil
......
...@@ -117,7 +117,7 @@ func NewProfileServer(ctx *cli.Context, opts ...interface{}) (interface{}, error ...@@ -117,7 +117,7 @@ func NewProfileServer(ctx *cli.Context, opts ...interface{}) (interface{}, error
cfg, err := ini.Load(defaultConfigFile) cfg, err := ini.Load(defaultConfigFile)
if err != nil { if err != nil {
return nil, fmt.Errorf("faild to parse %s, %v", defaultConfigFile, err) return nil, fmt.Errorf("failed to parse %s, %v", defaultConfigFile, err)
} }
return &ProfileServer{ return &ProfileServer{
...@@ -146,7 +146,7 @@ func (p *ClassifyPostBody) Post() (*RespClassify, error) { ...@@ -146,7 +146,7 @@ func (p *ClassifyPostBody) Post() (*RespClassify, error) {
defer response.Body.Close() defer response.Body.Close()
if response.StatusCode != 200 { if response.StatusCode != 200 {
return nil, fmt.Errorf("online learning faild") return nil, fmt.Errorf("online learning failed")
} }
resBody, err := ioutil.ReadAll(response.Body) resBody, err := ioutil.ReadAll(response.Body)
if err != nil { if err != nil {
...@@ -172,7 +172,7 @@ func (c *CollectorPost) Post() (*RespCollectorPost, error) { ...@@ -172,7 +172,7 @@ func (c *CollectorPost) Post() (*RespCollectorPost, error) {
defer response.Body.Close() defer response.Body.Close()
if response.StatusCode != 200 { if response.StatusCode != 200 {
return nil, fmt.Errorf("collect data faild") return nil, fmt.Errorf("collect data failed")
} }
resBody, err := ioutil.ReadAll(response.Body) resBody, err := ioutil.ReadAll(response.Body)
if err != nil { if err != nil {
...@@ -255,7 +255,7 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo, ...@@ -255,7 +255,7 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo,
for _, service := range services { for _, service := range services {
log.Infof("initializing checker service: %s", service.Name) log.Infof("initializing checker service: %s", service.Name)
if err := service.Instance.Init(); err != nil { if err := service.Instance.Init(); err != nil {
return fmt.Errorf("service init faild: %v", err) return fmt.Errorf("service init failed: %v", err)
} }
} }
...@@ -272,7 +272,7 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo, ...@@ -272,7 +272,7 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo,
} }
err := checkerService.Check(ch) err := checkerService.Check(ch)
if err != nil { if err != nil {
log.Errorf("service %s running faild, reason: %v", service.Name, err) log.Errorf("service %s running failed, reason: %v", service.Name, err)
continue continue
} }
} }
...@@ -291,7 +291,7 @@ func (s *ProfileServer) Analysis(message *PB.AnalysisMessage, stream PB.ProfileM ...@@ -291,7 +291,7 @@ func (s *ProfileServer) Analysis(message *PB.AnalysisMessage, stream PB.ProfileM
npipe, err := utils.CreateNamedPipe() npipe, err := utils.CreateNamedPipe()
if err != nil { if err != nil {
return fmt.Errorf("create named pipe faild") return fmt.Errorf("create named pipe failed")
} }
defer os.Remove(npipe) defer os.Remove(npipe)
...@@ -369,8 +369,8 @@ func (s *ProfileServer) Analysis(message *PB.AnalysisMessage, stream PB.ProfileM ...@@ -369,8 +369,8 @@ func (s *ProfileServer) Analysis(message *PB.AnalysisMessage, stream PB.ProfileM
//3. judge the workload type is exist in the database //3. judge the workload type is exist in the database
classProfile := &sqlstore.GetClass{Class: workloadType} classProfile := &sqlstore.GetClass{Class: workloadType}
if err := sqlstore.GetClasses(classProfile); err != nil { if err := sqlstore.GetClasses(classProfile); err != nil {
log.Errorf("inquery workload type table faild %v", err) log.Errorf("inquery workload type table failed %v", err)
return fmt.Errorf("inquery workload type table faild %v", err) return fmt.Errorf("inquery workload type table failed %v", err)
} }
if len(classProfile.Result) == 0 { if len(classProfile.Result) == 0 {
log.Errorf("%s is not exist in the table", workloadType) log.Errorf("%s is not exist in the table", workloadType)
...@@ -562,8 +562,8 @@ func (s *ProfileServer) InfoProfile(profileInfo *PB.ProfileInfo, stream PB.Profi ...@@ -562,8 +562,8 @@ func (s *ProfileServer) InfoProfile(profileInfo *PB.ProfileInfo, stream PB.Profi
classProfile := &sqlstore.GetClass{Class: workloadType} classProfile := &sqlstore.GetClass{Class: workloadType}
err := sqlstore.GetClasses(classProfile) err := sqlstore.GetClasses(classProfile)
if err != nil { if err != nil {
log.Errorf("inquery class_profile table faild") log.Errorf("inquery class_profile table failed")
return fmt.Errorf("inquery class_profile table faild") return fmt.Errorf("inquery class_profile table failed")
} }
if len(classProfile.Result) == 0 { if len(classProfile.Result) == 0 {
...@@ -818,7 +818,7 @@ func (s *ProfileServer) Training(message *PB.TrainMessage, stream PB.ProfileMgr_ ...@@ -818,7 +818,7 @@ func (s *ProfileServer) Training(message *PB.TrainMessage, stream PB.ProfileMgr_
return nil return nil
} }
_ = stream.Send(&PB.AckCheck{Name: "training the self collect data faild"}) _ = stream.Send(&PB.AckCheck{Name: "training the self collect data failed"})
return nil return nil
} }
...@@ -828,7 +828,7 @@ func (s *ProfileServer) Charaterization(profileInfo *PB.ProfileInfo, stream PB.P ...@@ -828,7 +828,7 @@ func (s *ProfileServer) Charaterization(profileInfo *PB.ProfileInfo, stream PB.P
npipe, err := utils.CreateNamedPipe() npipe, err := utils.CreateNamedPipe()
if err != nil { if err != nil {
return fmt.Errorf("create named pipe faild") return fmt.Errorf("create named pipe failed")
} }
defer os.Remove(npipe) defer os.Remove(npipe)
...@@ -989,8 +989,8 @@ func (s *ProfileServer) Delete(ctx context.Context, message *PB.DefineMessage) ( ...@@ -989,8 +989,8 @@ func (s *ProfileServer) Delete(ctx context.Context, message *PB.DefineMessage) (
// get the profile type from the classprofile table // get the profile type from the classprofile table
classProfile := &sqlstore.GetClass{Class: workloadType} classProfile := &sqlstore.GetClass{Class: workloadType}
if err := sqlstore.GetClasses(classProfile); err != nil { if err := sqlstore.GetClasses(classProfile); err != nil {
log.Errorf("inquery workload type table faild %v", err) log.Errorf("inquery workload type table failed %v", err)
return &PB.Ack{}, fmt.Errorf("inquery workload type table faild %v", err) return &PB.Ack{}, fmt.Errorf("inquery workload type table failed %v", err)
} }
if len(classProfile.Result) == 0 { if len(classProfile.Result) == 0 {
log.Errorf("%s is not exist in the table", workloadType) log.Errorf("%s is not exist in the table", workloadType)
...@@ -1007,13 +1007,13 @@ func (s *ProfileServer) Delete(ctx context.Context, message *PB.DefineMessage) ( ...@@ -1007,13 +1007,13 @@ func (s *ProfileServer) Delete(ctx context.Context, message *PB.DefineMessage) (
// delete profile depend the profiletype // delete profile depend the profiletype
for _, profileName := range profileNames { for _, profileName := range profileNames {
if err := sqlstore.DeleteProfile(profileName); err != nil { if err := sqlstore.DeleteProfile(profileName); err != nil {
log.Errorf("delete item from profile table faild %v ", err) log.Errorf("delete item from profile table failed %v ", err)
} }
} }
// delete classprofile depend the workloadType // delete classprofile depend the workloadType
if err := sqlstore.DeleteClassProfile(workloadType); err != nil { if err := sqlstore.DeleteClassProfile(workloadType); err != nil {
log.Errorf("delete item from classprofile tabble faild.") log.Errorf("delete item from classprofile tabble failed.")
return &PB.Ack{}, err return &PB.Ack{}, err
} }
return &PB.Ack{Status: "OK"}, nil return &PB.Ack{Status: "OK"}, nil
...@@ -1044,8 +1044,8 @@ func (s *ProfileServer) Update(ctx context.Context, message *PB.DefineMessage) ( ...@@ -1044,8 +1044,8 @@ func (s *ProfileServer) Update(ctx context.Context, message *PB.DefineMessage) (
// get the profile type from the classprofile table // get the profile type from the classprofile table
classProfile := &sqlstore.GetClass{Class: workloadType} classProfile := &sqlstore.GetClass{Class: workloadType}
if err := sqlstore.GetClasses(classProfile); err != nil { if err := sqlstore.GetClasses(classProfile); err != nil {
log.Errorf("inquery workload type table faild %v", err) log.Errorf("inquery workload type table failed %v", err)
return &PB.Ack{}, fmt.Errorf("inquery workload type table faild %v", err) return &PB.Ack{}, fmt.Errorf("inquery workload type table failed %v", err)
} }
if len(classProfile.Result) == 0 { if len(classProfile.Result) == 0 {
log.Errorf("%s is not exist in the table", workloadType) log.Errorf("%s is not exist in the table", workloadType)
......
...@@ -55,7 +55,7 @@ test01() ...@@ -55,7 +55,7 @@ test01()
atune-adm analysis > $ANALYSIS_LOG atune-adm analysis > $ANALYSIS_LOG
check_result $? 1 check_result $? 1
grep "collect data faild" $ANALYSIS_LOG grep "collect data failed" $ANALYSIS_LOG
check_result $? 0 check_result $? 0
done done
......
...@@ -63,7 +63,7 @@ test01() ...@@ -63,7 +63,7 @@ test01()
atune-adm analysis > $ANALYSIS_LOG atune-adm analysis > $ANALYSIS_LOG
check_result $? 1 check_result $? 1
grep "collect data faild" $ANALYSIS_LOG grep "collect data failed" $ANALYSIS_LOG
check_result $? 0 check_result $? 0
fi fi
done done
......
...@@ -55,7 +55,7 @@ test01() ...@@ -55,7 +55,7 @@ test01()
atune-adm analysis > $ANALYSIS_LOG atune-adm analysis > $ANALYSIS_LOG
check_result $? 1 check_result $? 1
grep "collect data faild" $ANALYSIS_LOG grep "collect data failed" $ANALYSIS_LOG
check_result $? 0 check_result $? 0
done done
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册