示例#1
0
#! /usr/bin/env python

from pythonlsf import lsf

if lsf.lsb_init("test") > 0:
    exit(1)

print '\n Hosts in cluster: ', lsf.get_host_names()

print '\n Clustername: ', lsf.ls_getclustername(), '\n'

print '{0:15s} {1:20s} {2:20s} {3:5s} {4:4s}'.format('Hostname', 'Type',
                                                     'Model', 'Cores', 'Load')

for info in lsf.get_host_info():
    #Deal with the case when hostname contain "-".
    if '-' in info.hostName:
        load = lsf.get_host_load("hname=" + "'" + info.hostName + "'",
                                 lsf.R15M)
    else:
        load = lsf.get_host_load("hname=" + info.hostName, lsf.R15M)

    if load >= 65535:
        load = -1

    print '{0:15s} {1:20s} {2:20s} {3:5d} {4:4.2f}'.format(
        info.hostName, info.hostType, info.hostModel, info.cores, load)

    resources = ""
    index = 0
    if info.nRes > 0:
示例#2
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 printQueueInfo():
    if lsf.lsb_init("test") > 0:
        return -1;

    strArr = lsf.new_stringArray(2); //array length is 2
    lsf.stringArray_setitem(strArr, 0, "normal");
    lsf.stringArray_setitem(strArr, 1, "short");

    for info in lsf.get_queue_info_by_name(strArr, 2):
        print info.queue;
        print info.description;
        print ''

    return 0;
    
if __name__ == '__main__':
    print("LSF Clustername is :", lsf.ls_getclustername())
    print(query_queue("normal"))
    printQueueInfo()
示例#3
0
from pythonlsf import lsf
if __name__ == '__main__':
   print("LSF Clustername is : {}".format(lsf.ls_getclustername()))
   if lsf.lsb_init("test") > 0:
       exit -1;
   host_names = None
   num_hosts = lsf.new_intp()
   lsf.intp_assign(num_hosts, 0)
   host_data = lsf.lsb_hostinfo_ex(host_names, num_hosts, "", 4096)
   all_host_data = lsf.hostInfoEntArray_frompointer(host_data)
   for i in range(0, lsf.intp_value(num_hosts)):
     hostname = all_host_data[i].host
     print(hostname)
     gpudata = all_host_data[i].gpuData
     print("ngpus avail_shared_gpus avail_excl_gpus")
     print("   {}              {}              {}". \
                format(gpudata.ngpus, gpudata.avail_shared_ngpus, gpudata.avail_excl_ngpus))
    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 printQueueInfo():
    if lsf.lsb_init("test") > 0:
        return -1;

    strArr = lsf.new_stringArray(1); #array length is 2
    lsf.stringArray_setitem(strArr, 0, "normal");
#    lsf.stringArray_setitem(strArr, 1, "short");

    for info in lsf.get_queue_info_by_name(strArr, 1):
        print(info.queue)
        print(info.description)
        print('')

    return 0;
    
if __name__ == '__main__':
    print("LSF Clustername is : {}".format(lsf.ls_getclustername()))
    print(query_queue("normal"))
    printQueueInfo()
示例#5
0
from pythonlsf import lsf

if lsf.lsb_init("test") > 0:
    exit(1)

print('\n Hosts in cluster: %s' % lsf.get_host_names())

print('\n Clustername: {0:30s} \n'.format(lsf.ls_getclustername()))

print('{0:15s} {1:20s} {2:20s} {3:5s} {4:4s}'.format('Hostname', 'Type',
                                                     'Model', 'Cores', 'Load'))

for info in lsf.get_host_info():
    #Deal with the case when hostname contain "-".
    if '-' in info.hostName:
        load = lsf.get_host_load("hname=" + "'" + info.hostName + "'",
                                 lsf.R15M)
    else:
        load = lsf.get_host_load("hname=" + info.hostName, lsf.R15M)

    if load >= 65535:
        load = -1

    print('{0:15s} {1:20s} {2:20s} {3:5d} {4:4.2f}'.format(
        info.hostName, info.hostType, info.hostModel, info.cores, load))

    resources = ""
    index = 0
    if info.nRes > 0:
        while (1):
            item = lsf.stringArray_getitem(info.resources, index)
#!/usr/local/bin/python2.7

from pythonlsf import lsf

print '\n Hosts in cluster: ', lsf.get_host_names()

print '\n Clustername: ', lsf.ls_getclustername(), '\n'

print '{0:15s} {1:20s} {2:20s} {3:5s} {4:4s}'.format('Hostname', 'Type',
                                                     'Model', 'Cores', 'Load')

for info in lsf.get_host_info():
    #Deal with the case when hostname contain "-".
    if '-' in info.hostName:
        load = lsf.get_host_load("hname=" + "'" + info.hostName + "'", lsf.R15M)
    else:
        load = lsf.get_host_load("hname=" + info.hostName, lsf.R15M)
    
    if load >= 65535:
        load = -1

    print '{0:15s} {1:20s} {2:20s} {3:5d} {4:4.2f}'.format(info.hostName,
                                                           info.hostType,
                                                           info.hostModel,
                                                           info.cores,
                                                           load)

    resources = ""
    index = 0;
    if info.nRes > 0:
        while(1):
from pythonlsf import lsf

if lsf.lsb_init("test") > 0:
    exit(1)

print('\n Hosts in cluster: %s' % lsf.get_host_names())

print('\n Clustername: {0:30s} \n'.format(lsf.ls_getclustername()))

print('{0:15s} {1:20s} {2:20s} {3:5s} {4:4s}'.format('Hostname', 'Type',
                                                     'Model', 'Cores', 'Load'))

for info in lsf.get_host_info():
    #Deal with the case when hostname contain "-".
    if '-' in info.hostName:
        load = lsf.get_host_load("hname=" + "'" + info.hostName + "'", lsf.R15M)
    else:
        load = lsf.get_host_load("hname=" + info.hostName, lsf.R15M)
    
    if load >= 65535:
        load = -1

    print('{0:15s} {1:20s} {2:20s} {3:5d} {4:4.2f}'.format(info.hostName,
                                                           info.hostType,
                                                           info.hostModel,
                                                           info.cores,
                                                           load))

    resources = ""
    index = 0;
    if info.nRes > 0: