Exemple #1
0
func Pbs_statque(handle int, id string, attribs []Attrib, extend string) ([]BatchStatus, error) {
	i := C.CString(id)
	defer C.free(unsafe.Pointer(i))

	a := attrib2attribl(attribs)
	defer freeattribl(a)

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

	batch_status := C.pbs_statque(C.int(handle), i, 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
}
Exemple #2
0
// StatQeueu return stat all queue.
func (t *Torque) StatQue() ([]Queue, error) {
	bs := C.pbs_statque(C.int(t.serverID), nil, nil, nil)
	if bs == nil {
		return nil, GetLastError()
	}
	defer C.pbs_statfree(bs)

	queues := make([]Queue, 0, 1)

	for cur := bs; cur != nil; cur = cur.next {
		q := Queue{}
		q.name = C.GoString(cur.name)
		q.attr = make(map[string]Attribute)

		for name, attr := range attrlToAttributeMap(cur.attribs) {
			q.attr[name] = attr
		}
		queues = append(queues, q)
	}

	return queues, nil
}