def set_project_domain(self, project_code, domain_key): """Modify the Domain of the Project whose code is given in parameter. It raises HPCStatsRuntimeError if either the Project code or the Domain key are not found in DB. """ domain = Domain(domain_key, None) if not domain.existing(self.db): raise HPCStatsRuntimeError( \ "unable to find domain %s in database" \ % (domain_key)) project = Project(None, project_code, None) if not project.find(self.db): raise HPCStatsRuntimeError( \ "unable to find project %s in database" \ % (project_code)) # Load the Project in DB to get its description project.load(self.db) project.domain = domain logger.info("updating project %s with new domain %s", project_code, domain_key) project.update(self.db)
def set_project_description(self, project_code, description): """Modify in DB the description of the Project given in parameter. It raises HPCStatsRuntimeError if the Project is not found in DB. """ project = Project(None, project_code, None) if not project.find(self.db): raise HPCStatsRuntimeError( \ "unable to find project %s in database" \ % (project_code)) # Load the Project from DB to get its domain key project.load(self.db) project.description = description logger.info("updating project %s with new description", project_code) project.update(self.db)