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

refactoring model and adding description field to LogEntry

parent 0de7da4b
No related branches found
No related tags found
No related merge requests found
Pipeline #8458 passed
atdb/docs/ATDB-LDV Data Model.png

60.9 KiB | W: | H:

atdb/docs/ATDB-LDV Data Model.png

60.2 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
......@@ -17,34 +17,32 @@ class Workflow(models.Model):
class Task(models.Model):
# Task control properties
taskID = models.CharField(db_index=True, max_length=30, blank=True, null=True)
task_type = models.CharField(max_length=20, default="task")
filter = models.CharField(max_length=30, blank=True, 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)
# note: the apparent naming reversal is intentional. Predecessors are somebody elses successors.
# todo: change to Integer... but then the specification service has to be changed to using a dict
# to properly translate a python 'None' string to a Null value.
predecessor = models.ForeignKey('self', related_name='successors', on_delete=models.SET_NULL, null=True,blank=True)
new_workflow_id = models.CharField(max_length=15, blank=True, null=True)
new_workflow_uri = models.CharField(max_length=100, blank=True, null=True)
workflow = models.ForeignKey(Workflow, related_name='tasks', on_delete=models.SET_NULL, null=True, blank=True)
skip = models.BooleanField(default=False)
creationTime = models.DateTimeField(default=datetime.utcnow, blank=True)
project = models.CharField(max_length=100, blank=True, null=True, default="unknown")
sas_id = models.CharField(max_length=15, blank=True, null=True)
priority = models.IntegerField(null=True)
purge_policy = models.CharField(max_length=5, default="no", blank=True, null=True)
stage_request_id = models.IntegerField(default=0,null=True)
# LOFAR properties
project = models.CharField(max_length=100, blank=True, null=True, default="unknown")
sas_id = models.CharField(max_length=15, blank=True, null=True)
inputs = models.JSONField(null=True, blank=True)
outputs = models.JSONField(null=True, blank=True)
skip = models.BooleanField(default=False)
creationTime = models.DateTimeField(default=datetime.utcnow, blank=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)
# relationships
workflow = models.ForeignKey(Workflow, related_name='tasks', 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):
return str(self.id) + ' - ' + str(self.sas_id)
......@@ -57,7 +55,6 @@ class Task(models.Model):
class LogEntry(models.Model):
task = models.ForeignKey(Task, related_name='log_entries', on_delete=models.CASCADE, null=False)
cpu_cycles = models.IntegerField(null=True,blank=True)
wall_clock_time = models.IntegerField(null=True,blank=True)
url_to_log_file = models.CharField(max_length=100, blank=True, null=True)
......@@ -65,6 +62,10 @@ class LogEntry(models.Model):
start_time = models.DateTimeField(blank=True, null=True)
end_time = models.DateTimeField(blank=True, null=True)
status = models.CharField(max_length=50,default="defined", blank=True, null=True)
description = models.CharField(max_length=100, blank=True, null=True)
# relationships
task = models.ForeignKey(Task, related_name='log_entries', on_delete=models.CASCADE, null=False)
def __str__(self):
return str(self.id)+ ' - '+ str(self.task)+' - '+self.status
......@@ -73,6 +74,8 @@ class LogEntry(models.Model):
class Status(models.Model):
name = models.CharField(max_length=50, default="unknown")
timestamp = models.DateTimeField(default=datetime.utcnow, blank=True)
# relationships
task = models.ForeignKey(Task, related_name='status_history', on_delete=models.CASCADE, null=False)
# the representation of the value in the REST API
......
......@@ -62,11 +62,6 @@ class StatusSerializer(serializers.ModelSerializer):
class WorkflowSerializer(serializers.ModelSerializer):
# tasks = serializers.StringRelatedField(
# many=True,
# required=False,
# )
class Meta:
model = Workflow
fields = "__all__"
......
......@@ -44,7 +44,7 @@
</div>
{% include 'taskdatabase/pagination.html' %}
</div>
<p class="footer"> Version 1.0.0 (22 jan 2021 - 17:00)
<p class="footer"> Version 1.0.0 (26 jan 2021 - 8:00)
<script type="text/javascript">
(function(seconds) {
var refresh,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment