Skip to content

Commit

Permalink
Merge pull request #415 from PanDAWMS/tania_dev
Browse files Browse the repository at this point in the history
 add plot variation by reqid to errors page & add time locked link to wns page
  • Loading branch information
tkorchug authored Nov 25, 2024
2 parents 56719b3 + 8c9931a commit e8c8fdf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
7 changes: 4 additions & 3 deletions core/pandajob/summary_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ def build_error_histograms(jobs, is_wn_instead_of_site=False):
'modificationtime': job['modificationtime'],
'site': job['computingsite'] if not is_wn_instead_of_site else job['wn'],
'code': ','.join(sorted(get_job_error_categories(job))),
'task': job['jeditaskid'],
'task': str(job['jeditaskid']),
'user': job['produsername'],
'request': str(job['reqid']),
})
timestamp_list.append(job['modificationtime'])

Expand All @@ -175,12 +176,12 @@ def build_error_histograms(jobs, is_wn_instead_of_site=False):
df.set_index('modificationtime', inplace=True)

# Apply the function to each column where you want low-impact values grouped
for column in ['site', 'code', 'task', 'user']:
for column in ['site', 'code', 'task', 'user', 'request']:
df = categorize_low_impact_by_percentage(df, column, threshold_percent)

# Generate JSON-ready data for each column
output_data = {}
for column in ['site', 'code', 'task', 'user']:
for column in ['site', 'code', 'task', 'user', 'request']:
output_data[column] = prepare_binned_and_total_data(df, column, freq=freq)

total_jobs_per_bin = df.resample(freq).size().reset_index(name='total')
Expand Down
7 changes: 7 additions & 0 deletions core/templates/errorSummary.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<li class="tabs-title"><a href="#panel_es_code" ng-click="es.enable_panel('code')">Error code</a></li>
<li class="tabs-title"><a href="#panel_es_site" ng-click="es.enable_panel('site')">{% if 'computingsite' in requestParams %}WN{% else %}Site{% endif %}</a></li>
<li class="tabs-title"><a href="#panel_es_user" ng-click="es.enable_panel('user')">User</a></li>
<li class="tabs-title"><a href="#panel_es_request" ng-click="es.enable_panel('request')">Request</a></li>
<li class="tabs-title"><a href="#panel_es_task" ng-click="es.enable_panel('task')">Task</a></li>
</ul>
<div class="tabs-content" data-tabs-content="es-tabs">
Expand All @@ -88,6 +89,12 @@
<div class="column medium-4 xlarge-2"><canvas class="chartjs_block" id="pieChartErr_user"></canvas></div>
</div>
</div>
<div class="tabs-panel" id="panel_es_request">
<div class="c3-plots-row row fixed-height">
<div class="column medium-8 xlarge-10"><canvas class="chartjs_block" id="barChartErrSplit_request"></canvas></div>
<div class="column medium-4 xlarge-2"><canvas class="chartjs_block" id="pieChartErr_request"></canvas></div>
</div>
</div>
<div class="tabs-panel" id="panel_es_task">
<div class="c3-plots-row row fixed-height">
<div class="column medium-8 xlarge-10"><canvas class="chartjs_block" id="barChartErrSplit_task"></canvas></div>
Expand Down
20 changes: 19 additions & 1 deletion core/templates/wnInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{% endblock %}
{% block extra_js %}
<script src="{% static 'js/humanize.min.js' %}"></script>
<script src="{% static "js/clipboardjs/clipboard.min.js" %}"></script>
<script src="{% static 'js/datatables/DataTables-1.10.13/js/jquery.dataTables.js' %}"></script>
<script src="{% static 'js/datatables/DataTables-1.10.13/js/dataTables.foundation.js' %}"></script>
<script src="{% static 'js/datatables/dataTables.num-html.js' %}"></script>
Expand All @@ -40,7 +41,9 @@ <h5>{{ alert.title }}</h5>

{% if wnname %}
<p><b>Worker node slot performance</b> {% if wnname != 'all' %} for node {{ wnname }} {% endif %} at <a class="bp-link" href="{% url 'siteInfo' site %}">{{ site }}</a>, sort by:
{% if 'sortby' in requestParams %}{% if requestParams.sortby == 'alpha' %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=count">count</a>{% else %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=alpha">alpha</a>{% endif %}{% else %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=count">count</a>{% endif %}</p>
{% if 'sortby' in requestParams %}{% if requestParams.sortby == 'alpha' %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=count">count</a>{% else %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=alpha">alpha</a>{% endif %}{% else %}<a class="bp-link" href="{{ request.session.urls_cut.nosorturl }}sortby=count">count</a>,{% endif %}
<a id="copy-button" class="bluelink" data-clipboard-text="https://{{ request.get_host }}{{ time_locked_url }}">copy time locked link</a>
</p>
{% endif %}

{% if wnPlotFailed %}
Expand Down Expand Up @@ -258,6 +261,21 @@ <h5>Warning! </h5>
"scrollX": true,
"aaSorting": [[20, 'desc']],
});

// copy time locked link to clipboard button
let clipboard = new ClipboardJS('#copy-button');
clipboard.on('success', function (e) {
let copy_button = document.getElementById('copy-button');
copy_button.innerHTML = 'copied!';
copy_button.classList.add('disabled');
e.clearSelection();
});

clipboard.on('error', function (e) {
let copy_button = document.getElementById('copy-button');
copy_button.innerHTML = 'copying failed!';
copy_button.classList.add('disabled');
});
});
</script>

Expand Down
23 changes: 17 additions & 6 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3484,6 +3484,13 @@ def wnInfo(request, site, wnname='all'):

if not is_json_request(request):
xurl = extensibleURL(request)
time_format = '%Y-%m-%dT%H:%M'
time_locked_url = removeParam(removeParam(removeParam(removeParam(xurl,
'date_from', mode='extensible'),
'date_to', mode='extensible'),
'hours', mode='extensible'),
'days', mode='extensible'
) + 'date_from=' + request.session['TFIRST'].strftime(time_format) + '&date_to=' + request.session['TLAST'].strftime(time_format)
del request.session['TFIRST']
del request.session['TLAST']
data = {
Expand All @@ -3501,6 +3508,7 @@ def wnInfo(request, site, wnname='all'):
'wnPlotFinished': wnPlotFinishedL,
'hours': hours,
'errthreshold': errthreshold,
'time_locked_url': time_locked_url,
'warning': warning,
'built': datetime.now().strftime("%H:%M:%S"),
}
Expand Down Expand Up @@ -5636,13 +5644,16 @@ def errorSummary(request):
# put into tmp table
transaction_key = insert_to_temp_table([f['fileid'] for f in files_input_unfinished])
extra_str = f"""select id from {get_tmp_table_name()} where TRANSACTIONKEY = {transaction_key}"""
else:
elif len(files_input_unfinished) > 0:
extra_str = ','.join([str(f['fileid']) for f in files_input_unfinished])
wildCardExtension += f""" and pandaid in (
select pandaid from {settings.DB_SCHEMA_PANDA}.filestable4 where jeditaskid={jeditaskid} and fileid in ({extra_str})
union all
select pandaid from {settings.DB_SCHEMA_PANDA_ARCH}.filestable_arch where jeditaskid={jeditaskid} and fileid in ({extra_str})
)"""
else:
extra_str = ''
if len(extra_str) > 0:
wildCardExtension += f""" and pandaid in (
select pandaid from {settings.DB_SCHEMA_PANDA}.filestable4 where jeditaskid={jeditaskid} and fileid in ({extra_str})
union all
select pandaid from {settings.DB_SCHEMA_PANDA_ARCH}.filestable_arch where jeditaskid={jeditaskid} and fileid in ({extra_str})
)"""
_logger.info('Finished set up view: {}'.format(time.time() - request.session['req_init_time']))

if not testjobs and 'jobstatus' not in request.session['requestParams']:
Expand Down

0 comments on commit e8c8fdf

Please sign in to comment.