Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional colours with cyclic usage #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/python/site-packages/slurmmon/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def job_html_report(job, syntax_highlight_css=config.syntax_highlight_css, synta
html += '<style>\n%s\n</style>' % syntax_highlight_css
html += '</head>'
html += '<body><h1>%s</h1><hr />' % job['JobID']
html += config.syntax_highlight(job['JobScript'])
html += '<img src=%s.png>' % job['JobID']
html += '<br /><hr /><br />'
html += '\n<pre>%s</pre>\n' % job['SacctReport']
html += '<br />'
Expand Down
37 changes: 33 additions & 4 deletions usr/sbin/slurmmon_whitespace_report
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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

Expand All @@ -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 += '<th>%s</th>' % s
html += '</tr>'

#entries

#Generate images with script
import Image
import ImageFont
import ImageDraw

for j in jobs_cpu_wasters:
html += '<tr>'
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 += '<td><a href="jobs/%s.html">%s</a></td>' % (x, x)
elif i==2:
html += '<td style="text-align:right;"><strong>%s</strong></td>' % x
elif i in (3, 4):
html += '<td style="text-align:right;">%s</td>' % x
elif i==5:
html += '<td><img src=jobs/%s.png></td>' % x
else:
html += '<td>%s</td>' % x
html += '</tr>\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))

Expand Down
6 changes: 5 additions & 1 deletion var/www/ganglia/graph.d/slurm_probejob_pendtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}

Expand Down