Skip to content
Snippets Groups Projects
Commit bc2ac9fc authored by Nico Vermaas's avatar Nico Vermaas
Browse files

add status count of jobs per task in details screen

parent 9501b051
No related branches found
No related tags found
1 merge request!309add status count of jobs per task in details screen
Pipeline #52995 passed
...@@ -159,6 +159,25 @@ class Task(models.Model): ...@@ -159,6 +159,25 @@ class Task(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse('task-detail-view-api', kwargs={'pk': self.pk}) return reverse('task-detail-view-api', kwargs={'pk': self.pk})
def get_jobs_statusses(self):
statusses = {}
# check the statusses of all the jobs of this id
jobs = Job.objects.filter(task_id=self.id)
for job in jobs:
try:
key = job.metadata['status'].lower()
# if key doesn't exist, add a new one
statusses.update({ key : 0 })
statusses[key] = statusses[key] + 1
except:
pass
return statusses
@property @property
def predecessor_status(self): def predecessor_status(self):
try: try:
...@@ -382,6 +401,7 @@ class Job(models.Model): ...@@ -382,6 +401,7 @@ class Job(models.Model):
except: except:
return "N/A" return "N/A"
class PostProcessingRule(models.Model): class PostProcessingRule(models.Model):
aggregation_key = models.CharField(db_index=True, max_length=20, default=None,null=True, blank=True) aggregation_key = models.CharField(db_index=True, max_length=20, default=None,null=True, blank=True)
trigger_status = models.CharField(db_index=True, default="unknown", max_length=50, blank=True, null=True) trigger_status = models.CharField(db_index=True, default="unknown", max_length=50, blank=True, null=True)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 6 July 2023 <p class="footer"> Version 7 July 2023
</div> </div>
{% include 'taskdatabase/refresh.html' %} {% include 'taskdatabase/refresh.html' %}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody>
<tr><td><b>id</b></td><td><a href="{% url 'task-detail-view-api' task.pk %}" target="_blank">{{ task.id }} </a></td></tr> <tr><td><b>id</b></td><td><a href="{% url 'task-detail-view-api' task.pk %}" target="_blank">{{ task.id }} </a></td></tr>
<tr><td><b>slurm jobs</b></td><td><a href="{% url 'job-list-view-api' %}?task_id={{ task.id }}" {{ task.id }} target="_blank">jobs for task {{ task.id }} </a></td></tr> <tr><td><b>slurm jobs</b></td><td><a href="{% url 'job-list-view-api' %}?task_id={{ task.id }}" {{ task.id }} target="_blank">jobs for task {{ task.id }} </a> {{ task.get_jobs_statusses }}</td></tr>
<tr><td><b>priority</b></td><td> <tr><td><b>priority</b></td><td>
{% if user.is_authenticated %} {% if user.is_authenticated %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment