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

added environment JSON to task

removed 'regular' filter from API task list
parent 50af5d9e
No related branches found
No related tags found
2 merge requests!191added environment JSON to task,!190added environment JSON to task
atdb/docs/ATDB-LDV Data Model.png

89.3 KiB | W: | H:

atdb/docs/ATDB-LDV Data Model.png

91.1 KiB | W: | H:

atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -23,6 +23,7 @@ class Task(models.Model): ...@@ -23,6 +23,7 @@ class Task(models.Model):
# Task control properties # Task control properties
task_type = models.CharField(max_length=20, default="regular") task_type = models.CharField(max_length=20, default="regular")
filter = models.CharField(max_length=30, blank=True, null=True) filter = models.CharField(max_length=30, blank=True, null=True)
environment = models.JSONField(null=True, blank=True)
new_status = models.CharField(max_length=50, default="defining", null=True) new_status = models.CharField(max_length=50, default="defining", null=True)
status = models.CharField(db_index=True, default="unknown", max_length=50,blank=True, null=True) status = models.CharField(db_index=True, default="unknown", max_length=50,blank=True, null=True)
...@@ -52,7 +53,8 @@ class Task(models.Model): ...@@ -52,7 +53,8 @@ class Task(models.Model):
predecessor = models.ForeignKey('self', related_name='successors', on_delete=models.SET_NULL, null=True, blank=True) predecessor = models.ForeignKey('self', related_name='successors', on_delete=models.SET_NULL, null=True, blank=True)
def __str__(self): def __str__(self):
return str(self.id) + ' - ' + str(self.sas_id)
return str(self.id) + ' - (' + self.task_type + ') - ' + str(self.sas_id)
# this translates a view-name (from urls.py) back to a url, to avoid hardcoded url's in the html templates # this translates a view-name (from urls.py) back to a url, to avoid hardcoded url's in the html templates
# bad : <td><a href="/atdb/taaks/{{ task.id }}/" target="_blank">{{ task.taskID }} </a> </td> # bad : <td><a href="/atdb/taaks/{{ task.id }}/" target="_blank">{{ task.taskID }} </a> </td>
......
...@@ -45,7 +45,7 @@ class TaskWriteSerializer(serializers.ModelSerializer): ...@@ -45,7 +45,7 @@ class TaskWriteSerializer(serializers.ModelSerializer):
'status','new_status', 'status','new_status',
'inputs','outputs','metrics','status_history', 'inputs','outputs','metrics','status_history',
'size_to_process','size_processed','total_processing_time', 'size_to_process','size_processed','total_processing_time',
'log_entries','meta_scheduling' 'log_entries','meta_scheduling','environment'
) )
def get_new_workflow_id(self, instance): def get_new_workflow_id(self, instance):
...@@ -100,7 +100,7 @@ class TaskReadSerializer(serializers.ModelSerializer): ...@@ -100,7 +100,7 @@ class TaskReadSerializer(serializers.ModelSerializer):
'status','new_status', 'status','new_status',
'inputs','outputs','metrics','status_history', 'inputs','outputs','metrics','status_history',
'size_to_process', 'size_processed', 'total_processing_time', 'size_to_process', 'size_processed', 'total_processing_time',
'log_entries','meta_scheduling' 'log_entries','meta_scheduling','environment'
] ]
read_only_fields = fields read_only_fields = fields
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 1.0.0 (1 feb 2021 - 8:00) <p class="footer"> Version 1.0.0 (1 feb 2021 - 14:00)
</div> </div>
......
...@@ -352,14 +352,13 @@ class DiagramView(ListView): ...@@ -352,14 +352,13 @@ class DiagramView(ListView):
# ---------- REST API views ----------- # ---------- REST API views -----------
# example: /atdb/tasks/ # example: /atdb/tasks/
# this shows only 'regular' tasks and not 'postprocessing' tasks # show all tasks (regular and postprocessing)
# the endpoint it kept 'tasks' for backward compatibility reasons.
class TaskListViewAPI(generics.ListCreateAPIView): class TaskListViewAPI(generics.ListCreateAPIView):
""" """
A pagination list of tasks, unsorted. A pagination list of tasks, unsorted.
""" """
model = Task model = Task
queryset = Task.objects.filter(task_type='regular').order_by('-priority', 'id') queryset = Task.objects.all().order_by('-priority', 'id')
# serializer_class = TaskSerializer # serializer_class = TaskSerializer
# using the Django Filter Backend - https://django-filter.readthedocs.io/en/latest/index.html # using the Django Filter Backend - https://django-filter.readthedocs.io/en/latest/index.html
......
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