Пример #1
0
// StatServer return statserver.
func (t *Torque) StatServer() (Server, error) {
	bs := C.pbs_statserver(C.int(t.serverID), nil, nil)
	if bs == nil {
		return Server{}, GetLastError()
	}
	defer C.pbs_statfree(bs)

	srv := Server{name: C.GoString(bs.name)}

	srv.attr = make(map[string]Attribute)
	for name, attr := range attrlToAttributeMap(bs.attribs) {
		srv.attr[name] = attr
	}

	return srv, nil
}
Пример #2
0
Файл: pbs.go Проект: jbarber/pbs
func Pbs_statserver(handle int, attribs []Attrib, extend string) ([]BatchStatus, error) {
	a := attrib2attribl(attribs)
	defer freeattribl(a)

	e := C.CString(extend)
	defer C.free(unsafe.Pointer(e))

	batch_status := C.pbs_statserver(C.int(handle), a, e)

	if batch_status == nil {
		return nil, errors.New(Pbs_strerror(int(C.pbs_errno)))
	}
	defer C.pbs_statfree(batch_status)

	batch := get_pbs_batch_status(batch_status)

	return batch, nil
}