diff --git a/atdb/taskdatabase/migrations/0002_auto_20210128_1120.py b/atdb/taskdatabase/migrations/0002_auto_20210128_1120.py new file mode 100644 index 0000000000000000000000000000000000000000..498ff177e828aab17c9be38a184853cf747731e3 --- /dev/null +++ b/atdb/taskdatabase/migrations/0002_auto_20210128_1120.py @@ -0,0 +1,32 @@ +# Generated by Django 3.1.4 on 2021-01-28 10:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('taskdatabase', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='task', + name='skip', + ), + migrations.AddField( + model_name='task', + name='metrics', + field=models.JSONField(blank=True, null=True), + ), + migrations.AddField( + model_name='task', + name='resume', + field=models.BooleanField(default=True), + ), + migrations.AlterField( + model_name='task', + name='stage_request_id', + field=models.IntegerField(null=True), + ), + ] diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index 80397b46bae4aa61afa049586c519a8ba62d2d83..eb775c2adb584d69033947b42571113e48c6155a 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -27,18 +27,19 @@ class Task(models.Model): new_workflow_id = models.CharField(max_length=15, blank=True, null=True) new_workflow_uri = models.CharField(max_length=100, blank=True, null=True) - skip = models.BooleanField(default=False) + resume = models.BooleanField(default=True) creationTime = models.DateTimeField(default=datetime.utcnow, blank=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) + stage_request_id = models.IntegerField(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) + metrics = models.JSONField(null=True, blank=True) # relationships workflow = models.ForeignKey(Workflow, related_name='tasks', on_delete=models.SET_NULL, null=True, blank=True) diff --git a/atdb/taskdatabase/serializers.py b/atdb/taskdatabase/serializers.py index f08f750e9bce8c3b7e598f7747642f6ea37072c7..d09d11094d4e5bc0ad4db62f62963bde266f78b6 100644 --- a/atdb/taskdatabase/serializers.py +++ b/atdb/taskdatabase/serializers.py @@ -44,11 +44,11 @@ class TaskSerializer(serializers.ModelSerializer): class Meta: model = Task fields = ('id','task_type','taskID','filter','predecessor','successors', - 'project','sas_id','priority','purge_policy','skip', + 'project','sas_id','priority','purge_policy','resume', 'new_workflow_id','new_workflow_uri','workflow', 'stage_request_id', 'status','new_status', - 'inputs','outputs','status_history', + 'inputs','outputs','metrics','status_history', 'log_entries' ) diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 74caa9d93e52c1724c6b1e048cdd37995edf07df..d4dd04e62fb5c091b665a3ba23b94ba9e5046695 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -44,7 +44,7 @@ </div> {% include 'taskdatabase/pagination.html' %} </div> - <p class="footer"> Version 1.0.0 (26 jan 2021 - 10:00) + <p class="footer"> Version 1.0.0 (28 jan 2021 - 11:00) <script type="text/javascript"> (function(seconds) { var refresh, diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py index e35e6679a4f82a9017e881dd6c83b1eda26a00c6..397793823153999cfab885a43927ebdbd584745d 100644 --- a/atdb/taskdatabase/views.py +++ b/atdb/taskdatabase/views.py @@ -189,6 +189,13 @@ class LogEntryDetailsViewAPI(generics.RetrieveUpdateDestroyAPIView): queryset = LogEntry.objects.all() serializer_class = LogEntrySerializer + # overriding the update, because the status that comes in with the LogEntry + # also needs to propagate to the task.new_status + def perform_update(self, serializer): + log_entry = serializer.save() + task = log_entry.task + task.new_status = log_entry.status + task.save() # --- controller resources, triggered by a button in the GUI or directoy with a URL --- # set task status to 'new_status' - called from the GUI