Пример #1
0
func onDeMaterialize(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {

	log.Println("dematerializing")
	rr, err := spi.RemoveRealization(user + ":" + design.Name + "-cypress:cypress")
	if err != nil {
		log.Println("spi call to remove realization failed")
		log.Println(err)
		w.WriteHeader(500)
		return
	}
	if rr.Return != true {
		log.Println("the badness happened with the spi call to remove realization")
		w.WriteHeader(500)
		return
	}

	dmat := false
	for dmat == false {
		// check dematerialization status
		time.Sleep(1 * time.Second)
		log.Println("checking realization shutdown")
		ms, err := spi.ViewRealizations(user, ".*"+design.Name+".*")
		if err != nil {
			log.Println("[dmat] spi call to get realizations failed")
			log.Println(err)
			w.WriteHeader(500)
			return
		}
		if len(ms.Return) == 0 {
			log.Println("dematerialization finished")
			dmat = true
		}
	}

	log.Println("removing experiment")
	rx, err := spi.RemoveExperiment(user + ":" + design.Name)
	if err != nil {
		log.Println("spi call to remove experiment failed")
		log.Println(err)
		w.WriteHeader(500)
		return
	}
	if rx.Return != true {
		log.Println("the badness happened with the spi call to remove experiment")
		w.WriteHeader(500)
		return
	}

}
Пример #2
0
func remove() {

	cli.PreRun()

	if *xpF == "" {
		cli.Fatal(
			"you must specify an experiment name with the -xp flag, " +
				"use the -help flag for details")
	}

	rsp, err := spi.RemoveExperiment(*xpF)
	if err != nil {
		cli.Fatal(fmt.Sprintf("remove experiment failed: %v", err))
	}

	if rsp.Return != true {
		cli.Fatal("Removal of the experiment failed")
	}

}