Beispiel #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
	}

}
Beispiel #2
0
func remove() {

	if *rzF == "" {
		cli.Fatal(
			"you must specify a realization name with the -rz flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

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

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

}