Skip to content
Snippets Groups Projects
Commit 608dfd91 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-207: qa dataproduct paths

parent 92709a39
No related branches found
No related tags found
1 merge request!175Resolve TMSS-207
...@@ -335,14 +335,16 @@ def schedule_qafile_subtask(qafile_subtask: Subtask): ...@@ -335,14 +335,16 @@ def schedule_qafile_subtask(qafile_subtask: Subtask):
raise SubtaskSchedulingException("Cannot schedule subtask id=%d type=%s but type should be %s" % (qafile_subtask.pk, raise SubtaskSchedulingException("Cannot schedule subtask id=%d type=%s but type should be %s" % (qafile_subtask.pk,
qafile_subtask.specifications_template.type, SubtaskType.Choices.QA_FILES.value)) qafile_subtask.specifications_template.type, SubtaskType.Choices.QA_FILES.value))
if len(qafile_subtask.inputs.all()) != 1:
raise SubtaskSchedulingException("QA subtask id=%s should have 1 input, but it has %s" % (qafile_subtask.id, len(qafile_subtask.inputs)))
# step 1: set state to SCHEDULING # step 1: set state to SCHEDULING
qafile_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value) qafile_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value)
qafile_subtask.save() qafile_subtask.save()
# step 2: link input dataproducts # step 2: link input dataproducts
for input in qafile_subtask.inputs.all(): qa_input = qafile_subtask.inputs.first()
input.dataproducts.set(input.producer.dataproducts.all()) qa_input.dataproducts.set(qa_input.producer.dataproducts.all())
# step 3: resource assigner # step 3: resource assigner
# is a no-op for QA # is a no-op for QA
...@@ -350,7 +352,7 @@ def schedule_qafile_subtask(qafile_subtask: Subtask): ...@@ -350,7 +352,7 @@ def schedule_qafile_subtask(qafile_subtask: Subtask):
# step 4: create output dataproducts, and link these to the output # step 4: create output dataproducts, and link these to the output
# TODO: Should the output and/or dataproduct be determined by the specification in task_relation_blueprint? # TODO: Should the output and/or dataproduct be determined by the specification in task_relation_blueprint?
if qafile_subtask.outputs.first(): if qafile_subtask.outputs.first():
qafile_subtask_dataproduct = Dataproduct.objects.create(filename="L%d_QA.h5" % (qafile_subtask.id,), qafile_subtask_dataproduct = Dataproduct.objects.create(filename="L%s_%s_QA.h5" % (qa_input.producer.subtask_id, qafile_subtask.id),
directory="/data/qa/qa_files", directory="/data/qa/qa_files",
dataformat=Dataformat.objects.get(value=Dataformat.Choices.QA_HDF5.value), dataformat=Dataformat.objects.get(value=Dataformat.Choices.QA_HDF5.value),
producer=qafile_subtask.outputs.first(), producer=qafile_subtask.outputs.first(),
...@@ -382,21 +384,26 @@ def schedule_qaplots_subtask(qaplots_subtask: Subtask): ...@@ -382,21 +384,26 @@ def schedule_qaplots_subtask(qaplots_subtask: Subtask):
qaplots_subtask.specifications_template.type, qaplots_subtask.specifications_template.type,
SubtaskType.Choices.QA_PLOTS.value)) SubtaskType.Choices.QA_PLOTS.value))
if len(qaplots_subtask.inputs.all()) != 1:
raise SubtaskSchedulingException("QA subtask id=%s should have 1 input, but it has %s" % (qaplots_subtask.id, len(qaplots_subtask.inputs)))
# step 1: set state to SCHEDULING # step 1: set state to SCHEDULING
qaplots_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value) qaplots_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value)
qaplots_subtask.save() qaplots_subtask.save()
# step 2: link input dataproducts # step 2: link input dataproducts
# this should typically be a single input with a single dataproduct (the qa h5 file) # this should typically be a single input with a single dataproduct (the qa h5 file)
for input in qaplots_subtask.inputs.all(): qa_input = qaplots_subtask.inputs.first()
input.dataproducts.set(input.producer.dataproducts.all()) qa_input.dataproducts.set(qa_input.producer.dataproducts.all())
# step 3: resource assigner # step 3: resource assigner
# is a no-op for QA # is a no-op for QA
# step 4: create output dataproducts, and link these to the output # step 4: create output dataproducts, and link these to the output
# TODO: Should the output and/or dataproduct be determined by the specification in task_relation_blueprint? # TODO: Should the output and/or dataproduct be determined by the specification in task_relation_blueprint?
qaplots_subtask_dataproduct = Dataproduct.objects.create(directory="/data/qa/plots/L%d" % (qaplots_subtask.id,), qafile_subtask = qaplots_subtask.predecessors.first()
obs_subtask = qafile_subtask.predecessors.first()
qaplots_subtask_dataproduct = Dataproduct.objects.create(directory="/data/qa/plots/L%s_%s" % (obs_subtask.id, qaplots_subtask.id),
dataformat=Dataformat.objects.get(value=Dataformat.Choices.QA_PLOTS.value), dataformat=Dataformat.objects.get(value=Dataformat.Choices.QA_PLOTS.value),
producer=qaplots_subtask.outputs.first(), producer=qaplots_subtask.outputs.first(),
specifications_doc="", specifications_doc="",
......
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