[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Efficiency & centralization of global information gathering?



Hereâs an alternative to matching hostnames in lmstat output:

 

#!/usr/bin/perl

 

my $running_claims = qx( condor_q -constraint 'JobStatus == 2 && ! isUndefined(ConcurrencyLimits)' -format '%v' 'split(ConcurrencyLimits, ", ")' );

 

my @running_claims = $running_claims =~ ( m{"([^"]+)"}g );

 

my %limit;

for (@running_claims) {

    my ($name, $count) = split(':');

    $count = length($count) ? $count : 1;

    $limit{$name} += $count;

}

 

for $key (keys(%limit)) {

    print "${key}_condor_used = $limit{$key}\n";

}

 

Then you can set the limit like so:

 

App_license_lmstat_available = <pulled from lmstat>

App_license_condor_used = <pulled from condor_q above>

App_license_limit =  $(app_license_lmstat_available) + $(app_license_condor_used)

 

Iâm trying to remember if thereâs a mechanism in the configuration where you can say â$(value:0) and get 0 if value is undefined, rather than using an if/endif block but Iâm not finding it offhand. So whateverâs generating the config file would need to take that into account since the code above will only produce outputs for limits which are in current use..

 

                -Michael Pelletier.