Пример #1
0
def test__getProcessorsForJobs(processorsPerTask, kwargs, expected):
    ce = PoolComputingElement("TestPoolCE")
    ce.processors = 16

    if processorsPerTask:
        ce.processorsPerTask = processorsPerTask
    res = ce._getProcessorsForJobs(kwargs)
    assert res == expected
Пример #2
0
def test__getProcessorsForJobs():
    ce = PoolComputingElement('TestPoolCE')
    ce.processors = 16

    kwargs = {}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 1

    kwargs = {'mpTag': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 1

    kwargs = {'mpTag': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'wholeNode': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'wholeNode': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {'mpTag': True, 'numberOfProcessors': 4}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    kwargs = {
        'mpTag': True,
        'numberOfProcessors': 4,
        'maxNumberOfProcessors': 8
    }
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 8

    kwargs = {
        'mpTag': True,
        'numberOfProcessors': 4,
        'maxNumberOfProcessors': 32
    }
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 16

    # something is in use
    ce.processorsPerTask = {1: 4}
    kwargs = {'mpTag': True, 'wholeNode': True}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 0

    kwargs = {'mpTag': True, 'wholeNode': False}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12

    kwargs = {'mpTag': True, 'numberOfProcessors': 2}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12

    kwargs = {'mpTag': True, 'maxNumberOfProcessors': 2}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 2

    kwargs = {'mpTag': True, 'maxNumberOfProcessors': 16}
    res = ce._getProcessorsForJobs(kwargs)
    assert res == 12