예제 #1
0
파일: drmaa.go 프로젝트: jbarber/drmaa
// Blocks the the programm until the given jobs left the system or
// a specific timeout is reached.
func (s *Session) Synchronize(jobIds []string, timeout int64, dispose bool) *Error {
	// TODO handle special string: DRMAA_ID_SESSION_ALL
	diag := C.makeString(stringSize)
	defer C.free(unsafe.Pointer(diag))

	job_ids := C.makeStringArray(C.int(len(jobIds) + 1))

	for i, jobid := range jobIds {
		C.setString(job_ids, C.CString(jobid), C.int(i))
	}
	C.setString(job_ids, nil, C.int(len(jobIds)))

	var disp C.int
	if dispose {
		disp = C.int(1)
	} else {
		disp = C.int(0)
	}

	if errNumber := C.drmaa_synchronize(job_ids, C.long(timeout), disp,
		diag, stringSize); errNumber != C.DRMAA_ERRNO_SUCCESS {
		ce := makeError(C.GoString(diag), errorId[errNumber])
		return &ce
	}

	return nil
}
예제 #2
0
파일: drmaa.go 프로젝트: jbarber/drmaa
// vector attributes
func setVectorAttributes(jt *JobTemplate, name *C.char, args []string) *Error {
	diag := C.makeString(stringSize)
	defer C.free(unsafe.Pointer(diag))

	//name := C.CString(C.DRMAA_V_ENV)
	//defer C.free(unsafe.Pointer(name))

	values := C.makeStringArray(C.int(len(args) + 1))
	defer C.freeStringArray(values, C.int(len(args)+1))

	for i, a := range args {
		C.setString(values, C.CString(a), C.int(i))
	}

	errNumber := C.drmaa_set_vector_attribute(jt.jt, name, values, diag, stringSize)

	if errNumber != C.DRMAA_ERRNO_SUCCESS && diag != nil {
		ce := makeError(C.GoString(diag), errorId[errNumber])
		return &ce
	}
	return nil
}