@staticmethod
    def create(session_maker, experiment_id, client_initial_data, server_initial_data, request_info, now = None):
        MAX_TRIES = 10
        counter = 0
        while True:
            session = session_maker()
            try:
                id = str(uuid.uuid4())
                experiment_type = session.query(ExperimentType).filter_by(exp_name = experiment_id.exp_name, cat_name = experiment_id.cat_name).first()
                if experiment_type is None:
                    raise CoordExc.ExperimentNotFoundError("Couldn't find experiment_type %s when creating Reservation" % experiment_id)

                reservation = Reservation(id, client_initial_data, server_initial_data, request_info, now)
                reservation.experiment_type = experiment_type
                session.add(reservation)
                try:
                    session.commit()
                    return reservation.id
                except sqlalchemy.exceptions.IntegrityError:
                    counter += 1
                    if counter == MAX_TRIES:
                        raise Exception("Couldn't create a session after %s tries" % MAX_TRIES)
            finally:
                session.close()
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/coordinator/sql/model.py/Reservation.create/original