Esempio n. 1
0
    def get_experiments_outputs_spec(self):
        import stores

        if not self.experiments.count():
            return None
        annotation = {
            'persistence_outputs': KeyTransform('outputs', 'persistence')
        }
        query = self.experiments.annotate(**annotation)
        experiment_data = query.values_list('id', 'experiment_group__id',
                                            'project__user__username',
                                            'project__name',
                                            'persistence_outputs')
        outputs_spec_data = {}
        for data in experiment_data:
            project_name = PROJECT_UNIQUE_NAME_FORMAT.format(user=data[2],
                                                             project=data[3])

            if data[1]:
                group_name = GROUP_UNIQUE_NAME_FORMAT.format(
                    project_name=project_name, id=data[1])
                experiment_name = EXPERIMENT_UNIQUE_NAME_FORMAT.format(
                    parent_name=group_name, id=data[0])
            else:
                experiment_name = EXPERIMENT_UNIQUE_NAME_FORMAT.format(
                    parent_name=project_name, id=data[0])
            outputs_path = stores.get_experiment_outputs_path(
                persistence=data[4], experiment_name=experiment_name)
            outputs_spec_data[data[0]] = OutputsRefsSpec(path=outputs_path,
                                                         persistence=data[4])

        return outputs_spec_data
Esempio n. 2
0
 def unique_name(self):
     if self.experiment_group:
         parent_name = self.experiment_group.unique_name
     else:
         parent_name = self.project.unique_name
     return EXPERIMENT_UNIQUE_NAME_FORMAT.format(parent_name=parent_name,
                                                 id=self.id)