# Path: HPCStats/Exceptions.py
# class HPCStatsDBIntegrityError(HPCStatsException):
# 
#     """Class for DB intregrity errors exceptions in HPCStats"""
# 
#     def __init__(self, msg):
# 
#         super(HPCStatsDBIntegrityError, self).__init__(msg)
# 
# class HPCStatsRuntimeError(HPCStatsException):
# 
#     """Class for runtime errors exceptions in HPCStats"""
# 
#     def __init__(self, msg):
# 
#         super(HPCStatsRuntimeError, self).__init__(msg)


import logging
from HPCStats.Exceptions import HPCStatsDBIntegrityError, HPCStatsRuntimeError
                   AND cluster_id = %s
              """
        params = ( self.mountpoint,
                   self.cluster.cluster_id )

        db.execute(req, params)
        nb_rows = db.cur.rowcount
        if nb_rows == 0:
            logger.debug("filesystem %s not found in DB", str(self))
            return None
        elif nb_rows > 1:
            raise HPCStatsDBIntegrityError(
                    "several filesystem_id found in DB for filesystem %s" \
                      % (str(self)))
        else:
            self.fs_id = db.cur.fetchone()[0]
            logger.debug("filesystem %s found in DB with id %d",
                         str(self),
                         self.fs_id )
            return self.fs_id

    def save(self, db):
        """Insert Filesystem in database. You must make sure that the
           Filesystem does not already exist in database yet (typically using
           Filesystem.find() method else there is a risk of future integrity
           errors because of duplicated filesystems. If fs_id attribute is set,
           it raises HPCStatsRuntimeError.
        """

        if self.fs_id is not None:

# Path: HPCStats/Exceptions.py
# class HPCStatsDBIntegrityError(HPCStatsException):
# 
#     """Class for DB intregrity errors exceptions in HPCStats"""
# 
#     def __init__(self, msg):
# 
#         super(HPCStatsDBIntegrityError, self).__init__(msg)
# 
# class HPCStatsRuntimeError(HPCStatsException):
# 
#     """Class for runtime errors exceptions in HPCStats"""
# 
#     def __init__(self, msg):
# 
#         super(HPCStatsRuntimeError, self).__init__(msg)


# Path: HPCStats/Model/Filesystem.py
import logging
from HPCStats.Exceptions import HPCStatsDBIntegrityError, HPCStatsRuntimeError

                   AND cluster_id = %s
              """
        params = ( self.mountpoint,
                   self.cluster.cluster_id )

        db.execute(req, params)
        nb_rows = db.cur.rowcount
        if nb_rows == 0:
            logger.debug("filesystem %s not found in DB", str(self))
            return None
        elif nb_rows > 1:
            raise HPCStatsDBIntegrityError(
                    "several filesystem_id found in DB for filesystem %s" \
                      % (str(self)))
        else:
            self.fs_id = db.cur.fetchone()[0]
            logger.debug("filesystem %s found in DB with id %d",
                         str(self),
                         self.fs_id )
            return self.fs_id

    def save(self, db):
        """Insert Filesystem in database. You must make sure that the
           Filesystem does not already exist in database yet (typically using
           Filesystem.find() method else there is a risk of future integrity
           errors because of duplicated filesystems. If fs_id attribute is set,
           it raises HPCStatsRuntimeError.
        """

        if self.fs_id is not None:

            raise HPCStatsRuntimeError(