Example #1
0
File: task.go Project: rosrad/grid
func Run(conf *TaskConf, runer MdlTask) error {
	dev := SystemSet()
	if conf.Btrain && SysConf().Btrain {
		if err := runer.Train(); err != nil {
			return err
		}
	}
	if conf.Bgraph && SysConf().Bgraph {
		if err := MkGraph(runer.TargetDir()); err != nil {
			return err
		}
		fmt.Println("graph finished")
	}

	if conf.Bdecode && SysConf().Bdecode {
		fmt.Println("decoding")
		if err := DecodeSets(runer, DataSets(dev)); err != nil {
			Err().Println("Decode Err:", err)
			return err
		}
	}
	if conf.Bscore && SysConf().Bscore {
		msg := ""
		for _, set := range DataSets(dev) {
			// result := ScoreSets(runer, set)
			result, err := runer.Score(set)
			if err != nil {
				Trace().Println("Score Set", set)
				continue
			}

			res_str := fmt.Sprintf("#%s\n#%s\n%s\n",
				runer.TargetDir(),
				set,
				FormatScore(result))
			fmt.Println(res_str)
			if len(result) > 0 {
				msg += res_str
			}
			bf := bytes.NewBufferString(res_str)
			if err := ResultTo(bf, runer.Identify(), set); err != nil {
				return err
			}
		}
		if msg != "" {
			testlib.SendGmail(runer.TargetDir(), msg)
		}
	}
	return nil
}
Example #2
0
File: gmail.go Project: rosrad/grid
func TestGmail() {
	fmt.Println(testlib.SendGmail("test go", "from nagaoka"))
}