Example #1
0
    def add_experiment(self, identifier, **kw):
        org = Organization(self.organization, usr=self.github_user, pwd=self.github_password)
        if identifier in org.repos:
            self.warning_dialog('Experiment "{}" already exists'.format(identifier))
        else:
            root = os.path.join(paths.experiment_dataset_dir, identifier)

            if os.path.isdir(root):
                self.warning_dialog('{} already exists.'.format(root))
            else:
                if not self.default_team:
                    self.warning_dialog('No default team name set in Preferences.\n'
                                        'Please set a value (e.g "Users") and try creating the experiment again')
                    return False

                self.info('Creating experiment repository. {}'.format(identifier))

                org.create_repo(identifier, **kw)
                org.add_team_to_repository(self.default_team, identifier)

                url = '{}/{}/{}.git'.format(paths.git_base_origin, self.organization, identifier)
                Repo.clone_from(url, root)
                self.db.add_experiment(identifier)
                return True