示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    def create_domain(self, domain_key, domain_name):
        """Creates the domain whose key and name are given in parameters. It
           raises HPCStatsRuntimeError if another Domain with the same key
           already exists in DB.
        """
        domain = Domain(domain_key, domain_name)
        if domain.existing(self.db):
            raise HPCStatsRuntimeError("domain %s already exists in database" % (domain_key))

        logger.info("creating domain %s in database", domain_key)
        domain.save(self.db)
示例#4
0
    def create_domain(self, domain_key, domain_name):
        """Creates the domain whose key and name are given in parameters. It
           raises HPCStatsRuntimeError if another Domain with the same key
           already exists in DB.
        """
        domain = Domain(domain_key, domain_name)
        if domain.existing(self.db):
            raise HPCStatsRuntimeError("domain %s already exists in database" %
                                       (domain_key))

        logger.info("creating domain %s in database", domain_key)
        domain.save(self.db)