PBS Status HLRBII
"; $header[]='D1::'; $header[]='H1::'; $header[]='H2::'; $header[]='H3::'; $header[]='S1::'; $header[]='S2::'; $header[]='S3::'; $header[]='S4::'; $header[]='S5::'; $header[]='S6::'; $header[]='S7::'; $header[]='S8::'; $header[]='S9::'; $header[]='Q1::'; $header[]='UP::'; # #for ($i=0;$i<=$no_of_headers;$i++) { # print "defined headers:: $header[$i]"; #} #echo "
"; # # # header counter # $counter_d1=0; $counter_h1=0; $counter_h2=0; $counter_h3=0; $counter_s1=0; $counter_s2=0; $counter_s3=0; $counter_s4=0; $counter_s5=0; $counter_s6=0; $counter_s7=0; $counter_s8=0; $counter_s9=0; $counter_q1=0; $counter_up=0; # $slots_all=0; # #show_vars(); #exit; # #if (!$arr=file("/afs/lrz/common/betriebszustand/hlrb2-extern/batch_queues/OUTPUT.hlrb2_redesign")) { if (!$arr=file("/nfs/web_lrz/hls-stat/extern/htdocs/hlrb2/PBSPro/OUTPUT")){ echo " file not found
"; exit; } # # # #echo "
"; $number_of_lines=count($arr); # #echo "number of lines $number_of_lines
"; for ($i=0;$i<$number_of_lines;$i++) { $j=$i+1; #echo "line:: $j :: $arr[$i]
"; $number_of_args=sscanf($arr[$i],"%s",$was_ist_das); #echo "header:: $was_ist_das
"; # # # # echo "
Report was generated on | $weekday[$counter_d1] $day[$counter_d1] $month[$counter_d1] $year[$counter_d1] :: $present_time[$counter_d1] | "; echo "|
Machine Info | $uptime[$counter_h1] | "; break; case "H2::": $counter_h2 ++; $rest_string=substr($arr[$i],5); list($host[$counter_h2],$ncpus_for_pbs[$counter_h2],$ncpus_used_by_pbs[$counter_h2])=sscanf($rest_string,"%s %d %d"); # printf("|
%12s | cpus for PBS:: %4d | >cpus used by PBS:: %4d |
%12s | cpus for PBS:: %4d | >cpus used by PBS:: %4d | ",$host[$counter_h2],$ncpus_for_pbs[$counter_h2],$ncpus_used_by_pbs[$counter_h2]); break; case "S1::": $counter_s1 ++; #$i= (int) $counter_s1; $rest_string=substr($arr[$i],43); list($running_jobs[$counter_s1],$used_cpus[$counter_s1])=sscanf($rest_string,"%d %d"); # printf("
running jobs %8d | used cpus %4d | ",$running_jobs[$counter_s1],$used_cpus[$counter_s1]); break; case "S2::": $counter_s2 ++; $rest_string=substr($arr[$i],43); list($queued_jobs[$counter_s2],$requested_cpus[$counter_s2])=sscanf($rest_string,"%d %d"); # printf("|
queued jobs %8d | requested cpus %4d | ",$queued_jobs[$counter_s2],$requested_cpus[$counter_s2]); break; case "S3::": $counter_s3 ++; $rest_string=substr($arr[$i],43); list($other_jobs[$counter_s3],$requested_other_cpus[$counter_s3])=sscanf($rest_string,"%d %d"); # printf("|
other (held) jobs %8d | requested cpus %4d | ",$other_jobs[$counter_s3],$requested_other_cpus[$counter_s3]); break; case "S4::": $counter_s4 ++; $rest_string=substr($arr[$i],43); list($running_jobs_in_queue[$counter_s4],$run_queue[$counter_s4])=sscanf($rest_string,"%d %s"); # printf("|
running jobs:: %8d | in queue:: %s | ",$running_jobs_in_queue[$counter_s4],$run_queue[$counter_s4]); break; case "S5::": $counter_s5 ++; $rest_string=substr($arr[$i],43); list($number_of_cpus_in_queue[$counter_s5],$cpu_queue[$counter_s5])=sscanf($rest_string,"%d %s"); # printf("|
used cpus :: %8d | on node : %s | ",$number_of_cpus_in_queue[$counter_s5],$cpu_queue[$counter_s5]); break; case "S6::": $counter_s6 ++; $rest_string=substr($arr[$i],43); list($queued_jobs_in_queue[$counter_s6],$queued_queue[$counter_s6],$queued_cpus_in_queue[$counter_s6])=sscanf($rest_string,"%d %s %d"); # printf("|
queued jobs:: %8d | in queue:: %s | ",$queued_jobs_in_queue[$counter_s6],$queued_queue[$counter_s6]); break; case "S7::": $counter_s7 ++; $rest_string=substr($arr[$i],43); list($memory_requested_in_run_queue[$counter_s7],$memory_request_queue[$counter_s7])=sscanf($rest_string,"%d %s"); # printf("|
requested memory :: %8d | in queue:: %s | ",$memory_requested_in_run_queue[$counter_s7],$memory_request_queue[$counter_s7]); break; case "S9::": $counter_s9 ++; $rest_string=substr($arr[$i],43); #echo "|
used memory :: %8d GB | ",$entire_memory_used); break; case "Q1::": $counter_q1 ++; $rest_string=substr($arr[$i],43); list($queue[$counter_q1],$q_hour[$counter_q1],$q_min[$counter_q1],$q_sec[$counter_q1])=sscanf($rest_string,"%s %s %s %s"); # printf("||
waiting time in queue:: %s | %s %s %s | ",$queue[$counter_q1],$q_hour[$counter_q1],$q_min[$counter_q1],$q_sec[$counter_q1]); break; case "UP::": $counter_up ++; $rest_string=substr($arr[$i],36); $pos[$counter_up]=strpos($rest_string,'up'); $rest_string=substr($rest_string,$pos[$counter_up]); $pos[$counter_up]=strpos($rest_string,','); # printf("rest_string:: %s
"; # #show_vars(); # echo "jetzt geht es los
"; #exit; # ################################################################################ # # Summary (date and uptime of nodes) # $jobs_all=$running_jobs[1] + $queued_jobs[1] + $other_jobs[1]; # $part_arr=substr($arr[0],5); echo "
\n";
echo "PBS Usage at $part_arr
\n "; # for($i=1;$i<=$counter_up;$i++) { echo "
\n "; } # ################################################################################ # # first table: summary of Jobs # # echo "
Summary of all PBS HLRB2 jobs
\n"; echo "
"; #exit(); # ################################################################################ # # second table: running jobs and slot availability # # for ($i=1;$i<=$counter_h2;$i++) { $slots_all=$slots_all + $ncpus_for_pbs[$i]; } # $slots_all_used=$used_cpus[$counter_s1]; # $slots_available= $slots_all - $slots_all_used; $subscription_factor= number_format(($slots_all_used/$slots_all),2); if ($subscription_factor > 0.85) { $bg_over1=$bgred; } else { $bg_over1=$bgalarm; }; #show_vars(); #echo "color $bg_over1
"; #exit; # echo "Slots Usage and Run Queues
"; echo "
"; #exit(); ############################################################################################################################ # # table 2 A: slots availability per node # # $bg2=$background_color; $bg4=$background_color; $bga=$background_color; $bg_feld=$bgalarm; # $slots_oversubscription= number_format(($requested_cpus[1]/$slots_all),2); if ($slots_oversubscription >= 1.0 ) {$bg_over=$bgred; } else { $bg_over=$bg_feld; }; #echo "color $bg_over
"; #show_vars(); #exit(); # echo "Slot Availability per Node
\n"; # echo "\n";
echo "
\n"; #exit(); if (! ($queued_jobs[1] == 0)) { #if ($queued_jobs != 0) { ############################################################################################################################ # # third table: queued jobs # # $bg2=$background_color; $bg4=$background_color; $bga=$background_color; $bg_feld=$bgalarm; # $slots_oversubscription= number_format(($requested_cpus[1]/$slots_all),2); if ($slots_oversubscription >= 1.0 ) {$bg_over=$bgred; } else { $bg_over=$bg_feld; }; #echo "color $bg_over
"; #show_vars(); # echo "Queued jobs
\n"; # echo"
"; #exit(); ############################################################################################################################ # # fourth table: waiting times in queues # # echo "Longest waiting time
"; # echo "
"; } echo "\n"; echo "
\n";
?>\n "; # for($i=1;$i<=$counter_up;$i++) { echo "
Uptime of login node:: $uptime[$i]
\n "; } # ################################################################################ # # first table: summary of Jobs # # echo "
Summary of all PBS HLRB2 jobs
\n"; echo "
Jobs | all | Running | Queued | held jobs |
Overview | $jobs_all | $running_jobs[1] | $queued_jobs[1] | $other_jobs[1] |
"; #exit(); # ################################################################################ # # second table: running jobs and slot availability # # for ($i=1;$i<=$counter_h2;$i++) { $slots_all=$slots_all + $ncpus_for_pbs[$i]; } # $slots_all_used=$used_cpus[$counter_s1]; # $slots_available= $slots_all - $slots_all_used; $subscription_factor= number_format(($slots_all_used/$slots_all),2); if ($subscription_factor > 0.85) { $bg_over1=$bgred; } else { $bg_over1=$bgalarm; }; #show_vars(); #echo "color $bg_over1
"; #exit; # echo "Slots Usage and Run Queues
"; echo "
machine | used slots | available slots | free slots (for PBS) | subscription factor | used memory (GB) |
PBS Complex | $slots_all_used | $slots_all | $slots_available | $subscription_factor | $entire_memory_used |
PBS Run Queue | running jobs | used slots | |||
$run_queue[$i] | $running_jobs_in_queue[$i] | $number_of_cpus_in_queue[$i] |
"; #exit(); ############################################################################################################################ # # table 2 A: slots availability per node # # $bg2=$background_color; $bg4=$background_color; $bga=$background_color; $bg_feld=$bgalarm; # $slots_oversubscription= number_format(($requested_cpus[1]/$slots_all),2); if ($slots_oversubscription >= 1.0 ) {$bg_over=$bgred; } else { $bg_over=$bg_feld; }; #echo "color $bg_over
"; #show_vars(); #exit(); # echo "Slot Availability per Node
\n"; # echo "
available / used / percentage | \n"; } echo "
$ausgabe_string | \n"; // Insert end of row after 6 cells if ($i_modulo == 0) { echo"\n"; // Insert end of row after 6 cells if ($i_modulo == 0) { echo"\n"; } } // Only insert end of row if # of partitions not a multiple of 6 if ($i_modulo != 0) echo"\n"; echo " |
\n"; #exit(); if (! ($queued_jobs[1] == 0)) { #if ($queued_jobs != 0) { ############################################################################################################################ # # third table: queued jobs # # $bg2=$background_color; $bg4=$background_color; $bga=$background_color; $bg_feld=$bgalarm; # $slots_oversubscription= number_format(($requested_cpus[1]/$slots_all),2); if ($slots_oversubscription >= 1.0 ) {$bg_over=$bgred; } else { $bg_over=$bg_feld; }; #echo "color $bg_over
"; #show_vars(); # echo "Queued jobs
\n"; # echo"
queue | no. of queued jobs | available slots | requested slots | subscription factor |
Sum | $queued_jobs[1] | $slots_all | $requested_cpus[1] | $slots_oversubscription |
$queued_queue[$i] | $queued_jobs_in_queue[$i] | $queued_cpus_in_queue[$i] |
"; #exit(); ############################################################################################################################ # # fourth table: waiting times in queues # # echo "Longest waiting time
"; # echo "
waiting time by queue type | time |
$queue[$i] | $long_wait |
"; } echo "\n"; echo "