<commit_before>#!/bin/env python
#
# Description:
#   This tool displays the status of the glideinWMS pool
#   in a text format
#
# Arguments:
#   [-pool collector_node] Entries|Sites|Gatekeepers
#
# Author:
#   <NAME> (May 9th 2007)
#

import string
import sys
sys.path.append("../factory")
sys.path.append("../frontend")
sys.path.append("../lib")

import glideFactoryInterface
import glideinFrontendInterface

pool_name=None
remove_condor_stats=True
remove_internals=True
txt_type=None

# parse arguments
alen=len(sys.argv)
i=1
while (i<alen):
    ael=sys.argv[i]
    if ael=='-pool':
        i=i+1
        pool_name=sys.argv[i]
    elif ael in ('Entries','Sites','Gatekeepers'):
        txt_type=ael
    else:
        raise RuntimeError,"Unknown option '%s'"%ael
    i=i+1

# get data
glideins_obj=glideinFrontendInterface.findGlideins(pool_name)

# Get a dictionary of
#  RequestedIdle
#  Idle
#  Running
txt_data={}

# extract data
glideins=glideins_obj.keys()
for glidein in glideins:
    glidein_el=glideins_obj[glidein]

    key=glidein
    if txt_data.has_key(key):
        key_el=txt_data[key]
    else:
        key_el={'RequestedIdle':0,'Idle':0,'Running':0}
        txt_data[key]=key_el

    if glidein_el.has_key('monitor'):
        key_el['RequestedIdle']+=glidein_el['monitor']['TotalRequestedIdle']
        key_el['Idle']+=glidein_el['monitor']['TotalStatusIdle']
        key_el['Running']+=glidein_el['monitor']['TotalStatusRunning']

#print data
txt_keys=txt_data.keys()
txt_keys.sort()

print '%s  ReqIdle   Idle    Running'%string.ljust('Entry',40)
print '========================================-========-========-========'
for key in txt_keys:
    key_el=txt_data[key]
    print "%s %8i %8i %8i"%(string.ljust(key,40),key_el['RequestedIdle'],key_el['Idle'],key_el['Running'])

<commit_msg>Set key width to 50<commit_after>#!/bin/env python
#
# Description:
#   This tool displays the status of the glideinWMS pool
#   in a text format
#
# Arguments:
#   [-pool collector_node] Entries|Sites|Gatekeepers
#
# Author:
#   <NAME> (May 9th 2007)
#

import string
import sys
sys.path.append("../factory")
sys.path.append("../frontend")
sys.path.append("../lib")

import glideFactoryInterface
import glideinFrontendInterface

pool_name=None
remove_condor_stats=True
remove_internals=True
txt_type=None

# parse arguments
alen=len(sys.argv)
i=1
while (i<alen):
    ael=sys.argv[i]
    if ael=='-pool':
        i=i+1
        pool_name=sys.argv[i]
    elif ael in ('Entries','Sites','Gatekeepers'):
        txt_type=ael
    else:
        raise RuntimeError,"Unknown option '%s'"%ael
    i=i+1

# get data
glideins_obj=glideinFrontendInterface.findGlideins(pool_name)

# Get a dictionary of
#  RequestedIdle
#  Idle
#  Running
txt_data={}

# extract data
glideins=glideins_obj.keys()
for glidein in glideins:
    glidein_el=glideins_obj[glidein]

    key=glidein
    if txt_data.has_key(key):
        key_el=txt_data[key]
    else:
        key_el={'RequestedIdle':0,'Idle':0,'Running':0}
        txt_data[key]=key_el

    if glidein_el.has_key('monitor'):
        key_el['RequestedIdle']+=glidein_el['monitor']['TotalRequestedIdle']
        key_el['Idle']+=glidein_el['monitor']['TotalStatusIdle']
        key_el['Running']+=glidein_el['monitor']['TotalStatusRunning']

#print data
txt_keys=txt_data.keys()
txt_keys.sort()

print '%s  ReqIdle   Idle    Running'%string.ljust('Entry',50)
print '========================================-========-========-========'
for key in txt_keys:
    key_el=txt_data[key]
    print "%s %8i %8i %8i"%(string.ljust(key,50),key_el['RequestedIdle'],key_el['Idle'],key_el['Running'])


{'fraction_non_alphanumeric': 0.17805953693495039, 'fraction_numerical': 0.010474090407938258, 'mean_word_length': 4.591679506933744, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1833785', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1333, 'n_words': 230}