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


Python DbContainer.commit_thread_sql方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
    def __init__(self, project_code=None, login_code=None, site=None):
        self.set_app_server("batch")

        if not site:
            # if not explicitly set, keep the current site
           site = Site.get_site() 


        plugin_dir = Environment.get_plugin_dir()
        if plugin_dir not in sys.path:
            sys.path.insert(0, plugin_dir)

        super(Batch,self).__init__()

        self.login_code = login_code

        # clear the main container
        Container.create()

        if site:
            Site.set_site(site)

        # set this as the environment
        if not project_code:
            self.context = self.get_default_context()
        else:
            self.context = project_code

        Environment.set_env_object( self )

        # set up the security object
        security = Security()
        Environment.set_security(security)

        self._do_login()
        site_dir = Environment.get_site_dir()
        if site_dir not in sys.path:
            sys.path.insert(0, site_dir)

        # set the project
        from pyasm.biz import Project

        if self.context == "batch":
            Project.set_project("admin")
        else:
            Project.set_project(self.context)

        self.initialize_python_path()


        # start workflow engine
        #from pyasm.command import Workflow
        #Workflow().init()

        DbContainer.commit_thread_sql()
开发者ID:mincau,项目名称:TACTIC,代码行数:57,代码来源:batch.py

示例2: execute

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
 def execute(self):
     try:
         #Batch()
         #Command.execute_cmd(timed_trigger)
         Project.set_project(self.project_code)
         timed_triggers[self.index].execute()
     except Exception as e:
         raise
     finally:
         DbContainer.close_thread_sql()
         DbContainer.commit_thread_sql()
         DbContainer.close_all()
开发者ID:mincau,项目名称:TACTIC,代码行数:14,代码来源:monitor.py

示例3: execute

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
            def execute(self):
                start = time.time()
                #Batch()

                #print "refresh caches ..."
                caches = CacheContainer.get_all_caches()
                for key, cache in caches.items():
                    #print "... %s" % key, cache
                    cache.init_cache()
                #print "... %s seconds" % (time.time() - start)

                DbContainer.commit_thread_sql()
                DbContainer.close_all()
开发者ID:mincau,项目名称:TACTIC,代码行数:15,代码来源:cache_startup.py

示例4: execute

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
            def execute(my):
                #Batch()

                dirty_caches = CacheContainer.get_dirty()
                for dirty_cache in dirty_caches:
                    key = dirty_cache.get_value("key")
                    #print "... caching: ", key
                    cache = CacheContainer.get(key)
                    if not cache:
                        print "WARNING: cache [%s] does not exist in memory" % key
                        continue

                    cache.init_cache()

                DbContainer.commit_thread_sql()
                DbContainer.close_all()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:18,代码来源:cache_startup.py

示例5: __init__

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
    def __init__(my, project_code=None, login_code=None, site=None):
        my.set_app_server("batch")

        plugin_dir = Environment.get_plugin_dir()
        if plugin_dir not in sys.path:
            sys.path.insert(0, plugin_dir)

        super(Batch,my).__init__()

        my.login_code = login_code

        # clear the main container
        Container.create()

        if site:
            Site.set_site(site)

        # set this as the environment
        if not project_code:
            my.context = my.get_default_context()
        else:
            my.context = project_code

        Environment.set_env_object( my )

        # set up the security object
        security = Security()
        Environment.set_security(security)

        my._do_login()
        site_dir = Environment.get_site_dir()
        if site_dir not in sys.path:
            sys.path.insert(0, site_dir)

        # set the project
        from pyasm.biz import Project

        if my.context == "batch":
            Project.set_project("admin")
        else:
            Project.set_project(my.context)

        my.initialize_python_path()

        DbContainer.commit_thread_sql()
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:47,代码来源:batch.py

示例6: super

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]
                super(TimedTask, my).__init__(**kwargs)
                my.index = kwargs.get("index")
                my.project_code = kwargs.get("project_code")

            def execute(my):
                try:
                    #Batch()
                    #Command.execute_cmd(timed_trigger)
                    Project.set_project(my.project_code)
                    timed_triggers[my.index].execute()
                except Exception, e:
                    print "Error running trigger"
                    raise
                finally:
                    DbContainer.close_thread_sql()
                    DbContainer.commit_thread_sql()
                    DbContainer.close_all()


        for idx, timed_trigger in enumerate(timed_triggers):

            data = timed_trigger.get_input()
            if not data:
                continue

            """
            data = {
                'type': 'interval',
                'interval': 10,
                'delay': 0,
                'mode': 'threaded'
开发者ID:funic,项目名称:TACTIC,代码行数:33,代码来源:monitor.py

示例7: execute

# 需要导入模块: from pyasm.search import DbContainer [as 别名]
# 或者: from pyasm.search.DbContainer import commit_thread_sql [as 别名]

#.........这里部分代码省略.........
            file_paths = [upload_path]
            file_types = [file_type]

            source_paths = [upload_path]
            from pyasm.biz import IconCreator
            if os.path.isfile(upload_path):
                icon_creator = IconCreator(upload_path)
                icon_creator.execute()

                web_path = icon_creator.get_web_path()
                icon_path = icon_creator.get_icon_path()
                if web_path:
                    file_paths = [upload_path, web_path, icon_path]
                    file_types = [file_type, 'web', 'icon']

            from pyasm.checkin import FileCheckin
            checkin = FileCheckin(project, context='icon', file_paths=file_paths, file_types=file_types)
            checkin.execute()

        # find project's base_type
        base_type = project.get_base_type()

        if not base_type and project_type =='unittest':
            base_type = 'unittest'
        elif not base_type:
            base_type = 'simple'


        # get the database for this project
        db_resource = project.get_project_db_resource()

        database = db_resource.get_database_impl()
        #database = DatabaseImpl.get()
        database_type = database.get_database_type()
        if database_type == 'Oracle':
            raise TacticException("Creation of project is not supported. Please create manually")




        # creating project database
        print "Creating database '%s' ..." % project_code
        try:
            # create the datbase
            database.create_database(db_resource)
        except Exception as e:
            print str(e)
            print "WARNING: Error creating database [%s]" % project_code





        # import the appropriate schema with config first
        database.import_schema(db_resource, base_type)

        self.create_schema(project_code)

        # before we upgrade, we have to commit the transaction
        # This is because upgrade actually run as separate processes
        # so if not commit has been made, the tables from importing the
        # schema will not have existed yet
        DbContainer.commit_thread_sql()


        self.upgrade()

        # import the appropriate data
        database.import_default_data(db_resource, base_type)


        # import default links
        if use_default_side_bar:
            self.import_default_side_bar()


        # create specified stypes
        self.create_search_types()


        # create theme
        if project_theme:
            self.create_theme(project_theme)



        # set as main project
        is_main_project = self.kwargs.get("is_main_project")
        if is_main_project in [True,'true','on']:
            Config.set_value("install", "default_project", project_code)
            Config.save_config()
            Config.reload_config()

        # initiate the DbContainer
        DbContainer.get('sthpw')


        self.info['result'] = "Finished creating project [%s]."%project_code

        print "Done."
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:create_project_cmd.py


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