Skip to content

Commit

Permalink
Resource usage
Browse files Browse the repository at this point in the history
  • Loading branch information
setaou committed Jun 20, 2023
1 parent 4fa9f2a commit 84a2086
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
32 changes: 30 additions & 2 deletions js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,36 @@ monetaFilters.filter('formatDateTimeShort', function() {
});

monetaFilters.filter('formatDuration', function() {
return function(duration) {
return moment.duration(duration * 1000).humanize();
return function (duration) {
units = ['d', 'h', 'min', 's', 'ms'];
units_s = [86400, 3600, 60, 1, 0.001];
output = '';

for (u = 0; u < units.length; u++) {
if (duration < units_s[u])
continue;

t = Math.floor(duration / units_s[u])
output += t + units[u] + ' '

duration %= units_s[u];
}

return output.trim();
}
});

monetaFilters.filter('formatBytes', function() {
return function(size) {
units = ['B', 'KB', 'MB', 'GB', 'TB'];
u = 0;

while (size > 1024) {
u++;
size /= 1024;
}

return size.toFixed(2) + ' ' + units[u];
}
});

Expand Down
20 changes: 10 additions & 10 deletions templates/events/moneta-task-report.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ <h5><strong>Execution Report</strong> - <a href="#/tasks/{{event.task}}/view">{{
<tbody>
<tr>
<td class="mon-field">Status</td>
<td>{{event['status']}}</td>
<td>{{event['status']}} (return code {{event['returncode']}})</td>
</tr>
<tr>
<td class="mon-field" width="1">Start time</td>
<td>{{event['start_time'] | formatDateTime}}</td>
</tr>
<tr>
<td class="mon-field" width="1">End time</td>
<td>{{event['end_time'] | formatDateTime}}</td>
<td class="mon-field" width="1">Run time</td>
<td>From {{event['start_time'] | formatDateTime}} to {{event['end_time'] | formatDateTime}}</td>
</tr>
<tr>
<td class="mon-field" width="1">Duration</td>
Expand All @@ -30,9 +26,13 @@ <h5><strong>Execution Report</strong> - <a href="#/tasks/{{event.task}}/view">{{
<td class="mon-field" width="1">Node</td>
<td>{{event['node']}}</td>
</tr>
<tr>
<td class="mon-field" width="1">Return code</td>
<td>{{event['returncode']}}</td>
<tr ng-if="event['maxrss']">
<td class="mon-field" width="1">Memory used</td>
<td>{{event['maxrss'] | formatBytes}}</td>
</tr>
<tr ng-if="event['cputime_user']">
<td class="mon-field" width="1">CPU time used</td>
<td>{{event['cputime_user'] | formatDuration}} user; {{event['cputime_user'] | formatDuration}} system</td>
</tr>
<tr ng-if="event['output']">
<td class="mon-field" width="1">Output</td>
Expand Down

0 comments on commit 84a2086

Please sign in to comment.