Skip to content

Commit

Permalink
Adding duration of slurm events in the table
Browse files Browse the repository at this point in the history
  • Loading branch information
guilbaults committed Jan 12, 2024
1 parent 2b00b29 commit cdc0394
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jobstats/templates/jobstats/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ <h2>{% translate "Node events" %}</h2>
<th scope="col">{% translate "Node" %}</th>
<th scope="col">{% translate "Start time" %}</th>
<th scope="col">{% translate "End time" %}</th>
<th scope="col">{% translate "Duration" %}</th>
<th scope="col">{% translate "Reason" %}</th>
</tr>
</thead>
Expand All @@ -168,6 +169,7 @@ <h2>{% translate "Node events" %}</h2>
<td>{{node_event.node_name}}</td>
<td><span data-toggle="tooltip" data-placement="top" title="{{node_event.time_start_dt}}">{{node_event.time_start_dt | naturaltime}} <span data-feather="info"></span></span></td>
<td><span data-toggle="tooltip" data-placement="top" title="{{node_event.time_end_dt}}">{{node_event.time_end_dt | naturaltime}} <span data-feather="info"></span></span></td>
<td>{{node_event.duration_dt | naturaltime}}</td>
<td>{{node_event.reason}}</td>
</tr>
{% endfor %}
Expand Down
2 changes: 2 additions & 0 deletions nodes/templates/nodes/node.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h2>{% translate "Node events" %}</h2>
<th scope="col">{% translate "Node" %}</th>
<th scope="col">{% translate "Start time" %}</th>
<th scope="col">{% translate "End time" %}</th>
<th scope="col">{% translate "Duration" %}</th>
<th scope="col">{% translate "Reason" %}</th>
</tr>
</thead>
Expand All @@ -24,6 +25,7 @@ <h2>{% translate "Node events" %}</h2>
<td>{{node_event.node_name}}</td>
<td><span data-toggle="tooltip" data-placement="top" title="{{node_event.time_start_dt}}">{{node_event.time_start_dt | naturaltime}} <span data-feather="info"></span></span></td>
<td><span data-toggle="tooltip" data-placement="top" title="{{node_event.time_end_dt}}">{{node_event.time_end_dt | naturaltime}} <span data-feather="info"></span></span></td>
<td>{{node_event.duration_dt | naturaltime}}</td>
<td>{{node_event.reason}}</td>
</tr>
{% endfor %}
Expand Down
5 changes: 5 additions & 0 deletions slurm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ def time_end_dt(self):
return None
return datetime.datetime.fromtimestamp(self.time_end)

def duration_dt(self):
if self.time_end == 0:
return None
return self.time_end_dt() - self.time_start_dt()


class JobTable(models.Model):
class StatesJob(models.IntegerChoices):
Expand Down

0 comments on commit cdc0394

Please sign in to comment.