game.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:astoptool 作者: zouliuyun 项目源码 文件源码
def transform(self, gameServers, all_gameServer_info=None):
        """
        Transform funcion. 
        eg: it will transformat from 
            ['astd_37wan_2', 'astd_51wan_99', 'astd_uoyoo_90']
        to
            {
                '10.6.20.1':['astd_37wan_2', 'astd_51wan_99'], 
                '10.6.20.2':['astd_uoyoo_90']
            }
        """
        if not all_gameServer_info:
            all_gameServer_info = self.all_gameServer_info

        IPS = list(set([ all_gameServer_info[each] for each in gameServers ]))
        locate_game_servers = { each:[] for each in IPS }
        for each in gameServers:
            locate_game_servers[all_gameServer_info[each]].append(each)
        return locate_game_servers

#    def sql_content_exec(self, gameServers, sql_content, backup='Yes', remote_dir=REMOTE_DIR):
#        locate_game_servers = self.transform(gameServers)
#        ips = locate_game_servers.keys()
#
#        def _sql_content_exec(sql_content, locate_game_servers, backup):
#            for gameServer in locate_game_servers[env.host_string]:
#                backup_dir = '{}/{}'.format(remote_dir, gameServer)
#                run('[ -d {0} ] || mkdir -p {0}'.format(backup_dir))
#                if backup.lower() == 'yes':
#                    run('pandora --dump --opt -R {0} >{1}/rollback_{0}.sql'.format(gameServer, backup_dir))
#                run('''pandora --update {} -e '{}' '''.format(gameServer, sql_content))
#
#        execute(_sql_content_exec, sql_content, locate_game_servers, backup=backup, hosts=ips)
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号