diff --git a/lib/python/site-packages/slurmmon/jobs.py b/lib/python/site-packages/slurmmon/jobs.py index e656e75..6634ed1 100644 --- a/lib/python/site-packages/slurmmon/jobs.py +++ b/lib/python/site-packages/slurmmon/jobs.py @@ -294,7 +294,7 @@ def job_html_report(job, syntax_highlight_css=config.syntax_highlight_css, synta html += '' % syntax_highlight_css html += '' html += '

%s


' % job['JobID'] - html += config.syntax_highlight(job['JobScript']) + html += '' % job['JobID'] html += '


' html += '\n
%s
\n' % job['SacctReport'] html += '
' diff --git a/usr/sbin/slurmmon_whitespace_report b/usr/sbin/slurmmon_whitespace_report index 818793a..59e292d 100755 --- a/usr/sbin/slurmmon_whitespace_report +++ b/usr/sbin/slurmmon_whitespace_report @@ -57,7 +57,7 @@ def write_report(output_dir, completed_jobs_cpu=True, live_nodes_cpu=True): range = datetime.timedelta(days=1) #the amount of entries to include in tables - limit = 15 + limit = 20 state = 'COMPLETED' @@ -95,6 +95,7 @@ def write_report(output_dir, completed_jobs_cpu=True, live_nodes_cpu=True): jobs_all = jobs.get_jobs(state=state, starttime=starttime, endtime=endtime, filter=config.filter_whitespace_cpu_job) + #--- cpu wasters @@ -110,21 +111,49 @@ def write_report(output_dir, completed_jobs_cpu=True, live_nodes_cpu=True): for s in ('user', 'job', 'CPU days wasted', 'CPU efficiency', 'cores allocated', 'job script preview (click job link for full details)'): html += '%s' % s html += '' - + #entries + + #Generate images with script + import Image + import ImageFont + import ImageDraw + for j in jobs_cpu_wasters: html += '' - for i, x in enumerate((j['User'], j['JobID'], int(round(j['CPU_Wasted']/(60*60*24))), '%d%%' % int(round(j['CPU_Efficiency']*100)), j['NCPUS'], config.syntax_highlight(j['JobScriptPreview']))): + for i, x in enumerate((j['User'], j['JobID'], int(round(j['CPU_Wasted']/(60*60*24))), '%d%%' % int(round(j['CPU_Efficiency']*100)), j['NCPUS'], j['JobID'])): if i==1: html += '%s' % (x, x) elif i==2: html += '%s' % x elif i in (3, 4): html += '%s' % x + elif i==5: + html += '' % x else: html += '%s' % x html += '\n' - + y_size = min( 42*18+40 ,len(j['JobScript'].splitlines())*18+40) + img = Image.new('RGB', (600, y_size), "white") + d = ImageDraw.Draw(img) + fontPath = "/usr/share/fonts/dejavu/DejaVuLGCSansMono.ttf" + fontSans12 = ImageFont.truetype ( fontPath, 12 ) + x_pos=20 + y_pos=20 + for line in j['JobScript'].splitlines(): + if line.rfind("module") !=-1 or line.rfind("mpirun") != -1 or line.rfind("srun") !=-1 or line.rfind("mpiexec") !=-1: + d.text( (x_pos,y_pos), line, font=fontSans12 , fill=(255, 0, 0) ) + else: + d.text( (x_pos,y_pos), line, font=fontSans12 , fill=(0, 0, 0) ) + y_pos = y_pos + 18 + if y_pos > y_size -20: + break + del d + try: + img.save(os.path.join(output_dir,"jobs/%s.png" % j['JobID']),'png') + except: + print "Unable to save image" + with open(os.path.join(jobs_dirname, '%s.html' % j['JobID']), 'w') as f: f.write(jobs.job_html_report(j)) diff --git a/var/www/ganglia/graph.d/slurm_probejob_pendtime.php b/var/www/ganglia/graph.d/slurm_probejob_pendtime.php index 432dbe2..23133bc 100644 --- a/var/www/ganglia/graph.d/slurm_probejob_pendtime.php +++ b/var/www/ganglia/graph.d/slurm_probejob_pendtime.php @@ -14,12 +14,16 @@ function graph_slurm_probejob_pendtime ( &$rrdtool_graph ) { } - $colours=array("#00000f","#FF0000","#00FF00","#FFFF00","#0000FF"); + $colours=array("#00000f","#FF0000","#00FF00","#FFFF00","#0000FF","#FFAA00","#FF00BB"); $i=0; foreach ( $json_conf['probejob_partitions'] as $partition) { $series = $series."LINE2:'".$partition."'".$colours[$i].":'".$partition."' "; $i++; + if(count($colours)<=$i) + { + i=0; + } }