Beispiel #1
0
    def test_missing_parameter_value_error(self):
        self.test_case.set_analysis_parameters()
        self.test_case.delete_some_parameter_values()

        pipeline = self.analysis.pipeline.process
        pipeline.enable_all_pipeline_steps()
        pipeline_tools.disable_runtime_steps_with_existing_outputs(
            pipeline)

        missing = pipeline_tools.nodes_with_missing_inputs(pipeline)

        self.assertTrue(missing)
Beispiel #2
0
 def _check_input_files(self, subject_ids):
     subjects_with_missing_inputs = []
     for subject_id in subject_ids:
         analysis = self._study.analyses[subject_id]
         analysis.subject = subject_id
         analysis.propagate_parameters()
         missing = pipeline_tools.nodes_with_missing_inputs(
             analysis.pipeline)
         if missing:
             subject = self._study.subjects[subject_id]
             subjects_with_missing_inputs.append(str(subject))
     if len(subjects_with_missing_inputs) != 0:
         raise MissingInputFileError("Subjects: %s" % ", ".join(subjects_with_missing_inputs))
Beispiel #3
0
    def _create_workflow(self, subject_ids):
        study_config = self._study
        workflow = Workflow(
            name='Morphologist UI - %s' % study_config.study_name,
            jobs=[])
        workflow.root_group = []
        initial_vol_format = study_config.volumes_format

        priority = (len(subject_ids) - 1) * 100
        for subject_id in subject_ids:
            analysis = self._study.analyses[subject_id]
            subject = self._study.subjects[subject_id]

            analysis.set_parameters(subject)
            #analysis.propagate_parameters()
            pipeline = analysis.pipeline
            pipeline.enable_all_pipeline_steps()
            # force highest priority normalization method
            # FIXME: specific knowledge of Morphologist should not be used here.
            pipeline.Normalization_select_Normalization_pipeline \
                  = 'NormalizeSPM'
            pipeline_tools.disable_runtime_steps_with_existing_outputs(
                pipeline)

            missing = pipeline_tools.nodes_with_missing_inputs(pipeline)
            if missing:
                self.check_missing_models(pipeline, missing)
                print('MISSING INPUTS IN NODES:', missing)
                raise MissingInputFileError("subject: %s" % subject_id)

            wf = pipeline_workflow.workflow_from_pipeline(
                pipeline, study_config=study_config,
                jobs_priority=priority)
            njobs = len([j for j in wf.jobs if isinstance(j, Job)])
            if njobs != 0:
                priority -= 100
                workflow.jobs += wf.jobs
                workflow.dependencies += wf.dependencies
                group = Group(wf.root_group,
                            name='Morphologist %s' % str(subject))
                group.user_storage = subject_id
                workflow.root_group.append(group) # += wf.root_group
                workflow.groups += [group] + wf.groups

        return workflow