Пример #1
0
func buildjob(scen *scen.Scenario) *cloudlus.Job {
	scendata, err := json.Marshal(scen)
	check(err)

	tmpldata, err := ioutil.ReadFile(scen.CyclusTmpl)
	check(err)

	j := cloudlus.NewJobCmd("cycdriver", "-obj", "-out", outfile, "-scen", *scenfile)
	j.Timeout = *timeout
	j.AddInfile(scen.CyclusTmpl, tmpldata)
	j.AddInfile(*scenfile, scendata)
	j.AddOutfile(outfile)

	if flag.NArg() > 0 {
		j.Note = strings.Join(flag.Args(), " ")
	}

	return j
}
Пример #2
0
func BuildRemoteJob(s *scen.Scenario, objfile string) (*cloudlus.Job, error) {
	scendata, err := json.Marshal(s)
	if err != nil {
		return nil, err
	}

	tmpldata, err := ioutil.ReadFile(s.CyclusTmpl)
	if err != nil {
		return nil, err
	}

	j := cloudlus.NewJobCmd("cycobj", "-obj", objfile, "-scen", s.File)
	j.Timeout = 2 * time.Hour
	j.AddInfile(s.CyclusTmpl, tmpldata)
	j.AddInfile(s.File, scendata)
	j.AddOutfile(objfile)

	if flag.NArg() > 0 {
		j.Note = strings.Join(flag.Args(), " ")
	}

	return j, nil
}