当前位置: 首页>>代码示例>>Python>>正文


Python DataLayer.start_transaction方法代码示例

本文整理汇总了Python中enarksh.DataLayer.DataLayer.start_transaction方法的典型用法代码示例。如果您正苦于以下问题:Python DataLayer.start_transaction方法的具体用法?Python DataLayer.start_transaction怎么用?Python DataLayer.start_transaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在enarksh.DataLayer.DataLayer的用法示例。


在下文中一共展示了DataLayer.start_transaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __startup

# 需要导入模块: from enarksh.DataLayer import DataLayer [as 别名]
# 或者: from enarksh.DataLayer.DataLayer import start_transaction [as 别名]
    def __startup(self):
        """
        Performs the necessary actions for starting the controller daemon.
        """
        self.__log.info('Starting controller')

        credentials = Credentials.get()

        # Set database configuration options.
        DataLayer.config['host'] = credentials.get_host()
        DataLayer.config['user'] = credentials.get_user()
        DataLayer.config['password'] = credentials.get_password()
        DataLayer.config['database'] = credentials.get_database()
        DataLayer.config['port'] = credentials.get_port()
        DataLayer.config['autocommit'] = False

        # Connect to the MySQL.
        DataLayer.connect()
        DataLayer.start_transaction()

        # Sanitise the data in the database.
        DataLayer.enk_back_controller_init()

        # Create resources defined at host level.
        self.__create_host_resources()

        # Set the effective user and group to an unprivileged user and group.
        self.__set_unprivileged_user()

        # Commit transaction and close connection to MySQL.
        DataLayer.commit()
开发者ID:SetBased,项目名称:py-enarksh,代码行数:33,代码来源:Controller.py

示例2: handle

# 需要导入模块: from enarksh.DataLayer import DataLayer [as 别名]
# 或者: from enarksh.DataLayer.DataLayer import start_transaction [as 别名]
    def handle(_event, _event_data, controller):
        """
        Handles an empty event queue event.

        :param  _event: The event.
        :param * _event_data: Not used.
        :param enarksh.controller.Controller.Controller controller: The controller.
        """
        del _event, _event_data

        # Try the start nodes.
        EventQueueEmptyEventHandler.__queue_handler(controller)

        DataLayer.commit()
        DataLayer.disconnect()

        # If event queue is empty listen for new messages.
        if controller.event_controller.queue_size() == 0:
            controller.message_controller.receive_message(None, None, None)

        DataLayer.connect()
        DataLayer.start_transaction()
开发者ID:OlegKlimenko,项目名称:py-enarksh,代码行数:24,代码来源:EventQueueEmptyEventHandler.py


注:本文中的enarksh.DataLayer.DataLayer.start_transaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。