Search in sources :

Example 1 with NamedPoolQueueInfo

use of diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo in project dcache by dCache.

the class PoolCostMsgHandler method addNamedQueues.

/**
 * Add information about all "named" queues.  The available information is the same as with
 * regular queues, but there are arbirary number of these. The information is presented
 * underneath the named-queues branch of the queues branch:
 *
 * <pre>
 * [dCache]
 *  |
 *  +--[pools]
 *  |   |
 *  |   +--[&lt;poolName>]
 *  |   |   |
 *  |   |   +--[queues]
 *  |   |   |   |
 *  |   |   |   +--[named-queues]
 *  |   |   |   |   |
 *  |   |   |   |   +--[&lt;namedQueue1>]
 *  |   |   |   |   |    |
 *  |   |   |   |   |    +--active: nnn
 *  |   |   |   |   |    +--max-active: nnn
 *  </pre>
 *
 * @param update       the StateUpdate we are appending to
 * @param pathToQueues the StatePath pointing to [queues] above
 * @param thisPoolInfo the information about this pool.
 */
private void addNamedQueues(StateUpdate update, StatePath pathToQueues, PoolCostInfo thisPoolInfo, long lifetime) {
    Map<String, NamedPoolQueueInfo> namedQueuesInfo = thisPoolInfo.getExtendedMoverHash();
    if (namedQueuesInfo == null) {
        return;
    }
    StatePath pathToNamedQueues = pathToQueues.newChild("named-queues");
    for (NamedPoolQueueInfo thisNamedQueueInfo : namedQueuesInfo.values()) {
        addQueueInfo(update, pathToNamedQueues, thisNamedQueueInfo.getName(), thisNamedQueueInfo, lifetime);
    }
}
Also used : NamedPoolQueueInfo(diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo) StatePath(org.dcache.services.info.base.StatePath)

Example 2 with NamedPoolQueueInfo

use of diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo in project dcache by dCache.

the class PoolQueueTableWriter method print.

public void print(Collection<PoolCellQueryInfo> itemSet) {
    // 
    // get the translated list
    // 
    List<PoolCostEntry> list = preparePoolCostTable(itemSet);
    // 
    // calculate the totals ...
    // 
    TreeMap<String, int[]> moverMap = new TreeMap<>();
    int[][] total = new int[5][3];
    for (PoolCostEntry e : list) {
        if (e._movers != null) {
            for (Map.Entry<String, NamedPoolQueueInfo> entry : e._movers.entrySet()) {
                String queueName = entry.getKey();
                int[] t = moverMap.get(queueName);
                if (t == null) {
                    moverMap.put(queueName, t = new int[3]);
                }
                NamedPoolQueueInfo mover = entry.getValue();
                t[0] += mover.getActive();
                t[1] += mover.getMaxActive();
                t[2] += mover.getQueued();
            }
        }
        int[][] status = e._row;
        for (int j = 0; j < total.length; j++) {
            for (int l = 0; l < total[j].length; l++) {
                if (status[j] != null) {
                    total[j][l] += status[j][l];
                }
            }
        }
    }
    ActionHeaderExtension extension = new ActionHeaderExtension(moverMap);
    _html.beginTable(null);
    printPoolActionTableHeader(extension, HEADER_TOP);
    printPoolActionTableTotals(extension, total);
    int i = 0;
    for (PoolCostEntry e : list) {
        i++;
        printPoolActionRow(e, extension);
        if ((_repeatHeader != 0) && (i % _repeatHeader) == 0) {
            printPoolActionTableHeader(extension, HEADER_MIDDLE);
        }
    }
    printPoolActionTableTotals(extension, total);
    printPoolActionTableHeader(extension, HEADER_BOTTOM);
    _html.endTable();
}
Also used : NamedPoolQueueInfo(diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 3 with NamedPoolQueueInfo

use of diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo in project dcache by dCache.

the class PoolQueueTableWriter method getSortedMovers.

int[][] getSortedMovers(Map<String, NamedPoolQueueInfo> moverMap) {
    int[][] rows = new int[_map.size()][];
    if (moverMap == null) {
        for (int i = 0; i < _map.size(); i++) {
            rows[i] = new int[] { -1, -1, -1 };
        }
    } else {
        int i = 0;
        for (String key : _map.keySet()) {
            NamedPoolQueueInfo mover = moverMap.get(key);
            if (mover == null) {
                rows[i] = new int[] { -1, -1, -1 };
            } else {
                rows[i] = new int[] { mover.getActive(), mover.getMaxActive(), mover.getQueued() };
            }
            i++;
        }
    }
    return rows;
}
Also used : NamedPoolQueueInfo(diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo)

Aggregations

NamedPoolQueueInfo (diskCacheV111.pools.PoolCostInfo.NamedPoolQueueInfo)3 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 StatePath (org.dcache.services.info.base.StatePath)1