def test_resource_append():
    lists = {
        'time': [],
        'cpu': [],
        'memory_percent': [],
        'network-send': [],
        'network-recv': []
    }
    msg = {
        '10.10.20.86': {
            'cpu': 10,
            'memory_percent': 50,
            'time': 2000,
            'network-send': 2**16,
            'network-recv': 2**15
        },
        '10.10.20.87': {
            'cpu': 30,
            'memory_percent': 70,
            'time': 1000,
            'network-send': 2**17,
            'network-recv': 2**16
        }
    }

    resource_append(lists, msg)
    assert lists == {
        'time': [1500000],
        'cpu': [0.2],
        'memory_percent': [0.6],
        'network-send': [0.1875],
        'network-recv': [0.09375]
    }
def test_resource_append():
    lists = {"time": [], "cpu": [], "memory_percent": [], "network-send": [], "network-recv": []}
    msg = {
        "10.10.20.86": {
            "cpu": 10,
            "memory_percent": 50,
            "time": 2000,
            "network-send": 2 ** 16,
            "network-recv": 2 ** 15,
        },
        "10.10.20.87": {
            "cpu": 30,
            "memory_percent": 70,
            "time": 1000,
            "network-send": 2 ** 17,
            "network-recv": 2 ** 16,
        },
    }

    resource_append(lists, msg)
    assert lists == {
        "time": [1500000],
        "cpu": [0.2],
        "memory_percent": [0.6],
        "network-send": [0.1875],
        "network-recv": [0.09375],
    }
def test_resource_append():
    lists = {'time': [], 'cpu': [], 'memory-percent': [], 'network-send': []}
    msg = {'10.10.20.86': {'cpu': 10, 'memory-percent': 50, 'time': 2000,
                           'network-send': 2**16},
           '10.10.20.87': {'cpu': 30, 'memory-percent': 70, 'time': 1000,
                           'network-send': 2**17}}

    resource_append(lists, msg)
    assert lists == {'time': [1500000], 'cpu': [0.2], 'memory-percent': [0.6],
                     'network-send': [0.1875]}
Example #4
0
def workers():
    """ Get data from JSON route, store in messages deques """
    with log_errors():
        response = yield client.fetch('http://localhost:9786/workers.json')
        msg = json.loads(response.body.decode())
        if msg:
            messages['workers']['deque'].append(msg)
            messages['workers']['times'].append(time())
            resource_append(messages['workers']['plot-data'], msg)
            index = messages['workers']['index']
            index.append(last_index[0] + 1)
            last_index[0] += 1
Example #5
0
def workers():
    """ Get data from JSON route, store in messages deques """
    with log_errors():
        response = yield client.fetch(
            'http://%(host)s:%(http-port)d/workers.json' % options)
        msg = json.loads(response.body.decode())
        if msg:
            messages['workers']['deque'].append(msg)
            messages['workers']['times'].append(time())
            resource_append(messages['workers']['plot-data'], msg)
            index = messages['workers']['index']
            index.append(last_index[0] + 1)
            last_index[0] += 1
Example #6
0
def workers():
    """ Get data from JSON route, store in messages deques """
    try:
        response = yield client.fetch("http://%(host)s:%(http-port)d/workers.json" % options)
    except HTTPError:
        logger.warn("workers http route failed")
        return
    msg = json.loads(response.body.decode())
    if msg:
        messages["workers"]["deque"].append(msg)
        messages["workers"]["times"].append(time())
        resource_append(messages["workers"]["plot-data"], msg)
        index = messages["workers"]["index"]
        index.append(last_index[0] + 1)
        last_index[0] += 1
def workers():
    """ Get data from JSON route, store in messages deques """
    try:
        response = yield client.fetch(
                'http://%(host)s:%(http-port)d/workers.json' % options)
    except HTTPError:
        logger.warn("workers http route failed")
        return
    msg = json.loads(response.body.decode())
    if msg:
        messages['workers']['deque'].append(msg)
        messages['workers']['times'].append(time())
        resource_append(messages['workers']['plot-data'], msg)
        index = messages['workers']['index']
        index.append(last_index[0] + 1)
        last_index[0] += 1
Example #8
0
def test_resource_append():
    lists = {'time': [], 'cpu': [], 'memory-percent': []}
    msg = {
        '10.10.20.86': {
            'cpu': 10,
            'memory-percent': 50,
            'time': 2000
        },
        '10.10.20.87': {
            'cpu': 30,
            'memory-percent': 70,
            'time': 1000
        }
    }

    resource_append(lists, msg)
    assert lists == {'time': [1500000], 'cpu': [0.2], 'memory-percent': [0.6]}