diff --git a/atdb/atdb/static/taskdatabase/style.css b/atdb/atdb/static/taskdatabase/style.css index e293d1a7a87d08cd1c5b338cfdf5a15f5ed77b68..d63af60c0591260e0b272f3b7b87eaee29df83cd 100644 --- a/atdb/atdb/static/taskdatabase/style.css +++ b/atdb/atdb/static/taskdatabase/style.css @@ -13,6 +13,10 @@ TD { color: blue; } +.active { + background-color: lemonchiffon; +} + .error,.failed,.staging_failed,.processed_failed { color: red; font-weight: bold; diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py index 109ccd8173b2cd4593a1c8df066b0a0205e8a31d..4b2e0f65be28c17c4d7b956bc0d57eb0ab01bfb2 100644 --- a/atdb/taskdatabase/services/algorithms.py +++ b/atdb/taskdatabase/services/algorithms.py @@ -198,20 +198,15 @@ def aggregate_resources_tasks(): return workflow_results -def convert_aggregation_to_html(): - - # gather the data - workflow_results = aggregate_resources_tasks() - records = aggregate_resources_logs() - - # layout the data +def convert_aggregation_to_html(request): # --- Progress of tasks per active workflow --- + workflow_results = aggregate_resources_tasks() results_tasks = "<p>Progress of tasks per (active) workflow</p>" header = "<th>Workflow</th>" for status in settings.ALL_STATUSSES: header += "<th>" + status + "</th>" - results_tasks += header + "<th>active</th><th>total</th>" + results_tasks += header + '<th class="active">active</th><th>total</th>' for workflow_result in workflow_results: @@ -219,18 +214,37 @@ def convert_aggregation_to_html(): values = "<td><b>" + str(workflow_result['id'])+" - "+workflow_result['name'] + "</b></td>" for key in d: percentage = round(int(d[key]) / int(workflow_result['nr_of_tasks']) * 100) - values += "<td>" + str(percentage) + "% ("+str(d[key])+")</td>" + + # distinguish active statusses + style = "" + if key in settings.ACTIVE_STATUSSES or key=='active': + style = "active" + + # bonus: add a query link + query = "?status="+key+ "&workflow="+str(workflow_result['id']) + url = request.build_absolute_uri('/atdb/tasks')+query + link = '<a href="' + url + '" target="_blank">' + str(d[key]) + "</a>" + values += "<td class=" + style + ">" + str(percentage) + "% (" + link + ")</td>" + #values += "<td class="+style+">" + str(percentage) + "% ("+str(d[key])+")</td>" #values += "<td>" + str(d[key]) + "</td>" results_tasks += "<tr>" + values + "</tr>" results_tasks = "<tbody>" + results_tasks + "</tbody>" + # --- logentries --- + log_records = aggregate_resources_logs() results_logs = "" - for record in records: + + for record in log_records: + # distinguish active statusses + style = "" + if record['status'] in settings.ACTIVE_STATUSSES: + style = "active" + line = "<tr><td><b>" + record['name'] + "</b></td>"\ - '<td class="' + record['status'] + '" >' + record['status'] + \ + '<td class="' + style + '" >' + record['status'] + \ "</td><td>" + str(record['cpu_cycles']) + \ "</td><td>" + str(record['wall_clock_time']) + "</td><tr>" results_logs += line diff --git a/atdb/taskdatabase/static/taskdatabase/style.css b/atdb/taskdatabase/static/taskdatabase/style.css index 6a61c0078bbd2794e4fb9207c6139e4283a84c60..9919c7054fb401f417b73dcac632f70b272727e5 100644 --- a/atdb/taskdatabase/static/taskdatabase/style.css +++ b/atdb/taskdatabase/static/taskdatabase/style.css @@ -13,6 +13,10 @@ TD { color: blue; } +.active { + background-color: lemonchiffon; +} + .error,.failed,.staging_failed,.processed_failed { color: red; font-weight: bold; diff --git a/atdb/taskdatabase/templates/dashboard/dashboard.html b/atdb/taskdatabase/templates/dashboard/dashboard.html index 2d36ed2a9acc4bb01a16874d779f1f97e2906ce3..0282275d66bdad706973b8bc96890929bb417982 100644 --- a/atdb/taskdatabase/templates/dashboard/dashboard.html +++ b/atdb/taskdatabase/templates/dashboard/dashboard.html @@ -8,10 +8,12 @@ <div class="card"> <div class="card-body"> <h4>Dashboard</h4> + <table class="table table-striped"> {{ results_tasks | safe }} </table> + <table class="table table-striped"> <p>Resources used per step per active workflow</p> <th>Workflow</th><th>Status</th><th>CPU cycles</th><th>wall clock time</th> diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py index 187daffec835219610e15993cdf93bfab69118e7..568e2364ca801d75a13ace0bbbd3955c356ea665 100644 --- a/atdb/taskdatabase/views.py +++ b/atdb/taskdatabase/views.py @@ -253,7 +253,7 @@ def ShowConfig(request): def ShowDashboard(request): # gather the results - results_tasks,results_logs = algorithms.convert_aggregation_to_html() + results_tasks,results_logs = algorithms.convert_aggregation_to_html(request) return render(request, "dashboard/dashboard.html", {'results_tasks': results_tasks, 'results_logs': results_logs})