def query_queue(queue_name): """ "query queue info" """ if lsf.lsb_init("test") > 0: return -1; intp_num_queues = lsf.new_intp(); lsf.intp_assign(intp_num_queues, 1); strArr = lsf.new_stringArray(1); #print lsf.intp_value(intp_num_queues); lsf.stringArray_setitem(strArr, 0, queue_name); #print lsf.stringArray_getitem(strArr, 0); queueInfo = lsf.lsb_queueinfo(strArr,intp_num_queues,None,None,0); if queueInfo != None: print 'queueInfo is not null'; else: print 'queueInfo is null' return -1; print 'queue name = %s' % queueInfo.queue; print 'queue description = %s' % queueInfo.description; return 0;
def query_queue(queue_name): """ c api style """ if lsf.lsb_init("test") != 0: exit(1) intp_num_queues = lsf.new_intp() lsf.intp_assign(intp_num_queues, 1) queue_p = lsf.new_stringArray(1) lsf.stringArray_setitem(queue_p, 0, queue_name) info = lsf.lsb_queueinfo(queue_p, intp_num_queues, None, None, 0) if info is not None: return info.queue, info.description else: print 'queueInfo is null' exit(1)