Skip to content
Snippets Groups Projects
Commit cdc9d11a authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

TMSS-568: Adapt MoM migration script

parent f5e9acba
No related branches found
No related tags found
1 merge request!384Resolve TMSS-568
...@@ -506,7 +506,7 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project): ...@@ -506,7 +506,7 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project):
details = {"id": mom_details['mom2id'], details = {"id": mom_details['mom2id'],
"state": state, "state": state,
"specifications_doc": {}, # todo: where from? We have user_specification_id (for task?) and system_specification_id (for subtask?) on lofar_observation (I guess referring to lofar_observation_specification). Shall we piece things together from that, or is there a text blob to use? Also: pipeline info lives in obs_spec too? "specifications_doc": {}, # todo: where from? We have user_specification_id (for task?) and system_specification_id (for subtask?) on lofar_observation (I guess referring to lofar_observation_specification). Shall we piece things together from that, or is there a text blob to use? Also: pipeline info lives in obs_spec too?
"task_blueprint": task_blueprint, #"task_blueprint": task_blueprint, # ManyToMany, use set()
"specifications_template": specifications_template, "specifications_template": specifications_template,
"tags": ["migrated_from_MoM", "migration_incomplete"], # todo: set complete once it is verified that all info is present "tags": ["migrated_from_MoM", "migration_incomplete"], # todo: set complete once it is verified that all info is present
"priority": project.priority_rank, # todo: correct to derive from project? "priority": project.priority_rank, # todo: correct to derive from project?
...@@ -523,11 +523,13 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project): ...@@ -523,11 +523,13 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project):
if subtask_qs.count(): if subtask_qs.count():
# todo: this will update the subtask, but other TMSS objects do not share id with MoM and get recreated with every migration run. Can we clean this up somehow? # todo: this will update the subtask, but other TMSS objects do not share id with MoM and get recreated with every migration run. Can we clean this up somehow?
subtask_qs.update(**details) subtask_qs.update(**details)
subtask_qs.task_blueprints.set([task_blueprint])
subtask = subtask_qs.first() subtask = subtask_qs.first()
logger.info("...updated existing subtask tmss id=%s" % subtask.id) logger.info("...updated existing subtask tmss id=%s" % subtask.id)
stats['subtasks_updated'] += 1 stats['subtasks_updated'] += 1
else: else:
subtask = models.Subtask.objects.create(**details) subtask = models.Subtask.objects.create(**details)
subtask.task_blueprints.set([task_blueprint])
logger.info("...created new subtask tmss id=%s" % subtask.id) logger.info("...created new subtask tmss id=%s" % subtask.id)
stats['subtasks_created'] += 1 stats['subtasks_created'] += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment