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


import logging
from HPCStats.Exceptions import HPCStatsRuntimeError, HPCStatsDBIntegrityError
                   AND Event.event_start = %s
              """
        params = ( self.node.node_id,
                   self.cluster.cluster_id,
                   self.start_datetime )
        db.execute(req, params)
        nb_events = db.cur.rowcount
        if nb_events == 0:
            logger.debug("event %s not found in DB", str(self))
            return None
        elif nb_events > 1:
            raise HPCStatsDBIntegrityError(
                    "several event_id found for event %s" \
                      % (str(self)))
        else:
            self.event_id = db.cur.fetchone()[0]
            logger.debug("event %s found in DB with id %d",
                         str(self),
                         self.event_id )
            return self.event_id

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

        if self.event_id is not None:

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


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

                   AND Event.event_start = %s
              """
        params = ( self.node.node_id,
                   self.cluster.cluster_id,
                   self.start_datetime )
        db.execute(req, params)
        nb_events = db.cur.rowcount
        if nb_events == 0:
            logger.debug("event %s not found in DB", str(self))
            return None
        elif nb_events > 1:
            raise HPCStatsDBIntegrityError(
                    "several event_id found for event %s" \
                      % (str(self)))
        else:
            self.event_id = db.cur.fetchone()[0]
            logger.debug("event %s found in DB with id %d",
                         str(self),
                         self.event_id )
            return self.event_id

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

        if self.event_id is not None:

            raise HPCStatsRuntimeError(