diff --git a/SAS/TMSS/src/tmss/tmssapp/tasks.py b/SAS/TMSS/src/tmss/tmssapp/tasks.py index f8514f1cc06ab1f323eb9e8303f054da6766f3d3..837da51d8b9b1f0ed8f9b12438a07f8ebf71ab1e 100644 --- a/SAS/TMSS/src/tmss/tmssapp/tasks.py +++ b/SAS/TMSS/src/tmss/tmssapp/tasks.py @@ -125,7 +125,7 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model Create a task_blueprint from the task_draft :raises Exception if instantiate fails. """ - logger.debug("Create Task Blueprint from Task Draft (id=%s)", task_draft.pk) + logger.debug("creating task_blueprint from task_draft id=%s", task_draft.pk) # get or create a scheduling_unit_blueprint from the scheduling_unit_draft scheduling_unit_blueprint = task_draft.scheduling_unit_draft.scheduling_unit_blueprints.last() @@ -144,12 +144,12 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model specifications_template=task_draft.specifications_template ) - logger.info("Task Blueprint (id=%s) created from Task Draft (id=%s)", task_blueprint.pk, task_draft.pk) + logger.info("created task_blueprint id=%s from task_draft id=%s", task_blueprint.pk, task_draft.pk) # now that we have a task_blueprint, its time to refresh the task_draft so we get the non-cached fields task_draft.refresh_from_db() - # loop over consumers/producers, and 'copy'' the TaskRelationBlueprint from the TaskRelationDraft + # loop over consumers/producers, and 'copy' the TaskRelationBlueprint from the TaskRelationDraft # this is only possible if both 'ends' of the task_relation are converted to a TaskBlueprint # so, when converting two TaskDrafts (for example an observation and a pipeline), then for the conversion # of the first TaskDraft->TaskBlueprint no relation is setup, @@ -171,10 +171,10 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model selection_doc=task_relation_draft.selection_doc, selection_template=task_relation_draft.selection_template, dataformat=task_relation_draft.dataformat) - logger.info("Task Blueprint (id=%s) connected to Task Blueprint (id=%s) via Task Relation Blueprint (id=%s)", - task_blueprint.pk, producing_task_blueprint.pk, task_relation_blueprint.pk) + logger.info("created task_relation_blueprint id=%s which connects task_blueprints producer_id=%s and consumer_id=%s", + task_relation_blueprint.pk, producing_task_blueprint.pk, consuming_task_blueprint.pk,) - # Do the sam 'trick' for Task Scheduling Relation Draft to Blueprint + # Do the same 'trick' for Task Scheduling Relation Draft to Blueprint task_draft_scheduling_relations = list(task_draft.first_to_connect.all()) + list(task_draft.second_to_connect.all()) for task_scheduling_relation_draft in task_draft_scheduling_relations: for first_task_blueprint in task_scheduling_relation_draft.first.task_blueprints.all(): @@ -185,16 +185,13 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model second_id=second_task_blueprint.id) except models.TaskSchedulingRelationBlueprint.DoesNotExist: # ...'else' create it. - task_scheduling_relation_blueprint = models.TaskSchedulingRelationBlueprint.objects.create( - first=first_task_blueprint, - second=second_task_blueprint, - time_offset=task_scheduling_relation_draft.time_offset, - placement=task_scheduling_relation_draft.placement) - logger.info("Task Blueprint (id=%s) connected via scheduling relation with id=%s", - task_blueprint.pk, task_scheduling_relation_blueprint.pk) - logger.info("The scheduling relation is: '%s' (id=%s) '%s' '%s' (id=%s)", - first_task_blueprint.name, first_task_blueprint.pk, task_scheduling_relation_blueprint.placement, - second_task_blueprint.name, second_task_blueprint.pk) + task_scheduling_relation_blueprint = models.TaskSchedulingRelationBlueprint.objects.create(first=first_task_blueprint, + second=second_task_blueprint, + time_offset=task_scheduling_relation_draft.time_offset, + placement=task_scheduling_relation_draft.placement) + logger.info("created task_scheduling_relation_blueprint id=%s which connects task_blueprints first_id=%s and second_id=%s, placement=%s time_offset=%s[sec]", + task_scheduling_relation_blueprint.pk, first_task_blueprint.pk, second_task_blueprint.pk, task_scheduling_relation_draft.placement, task_scheduling_relation_draft.time_offset) + return task_blueprint