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


Python Manager.purgeGroup方法代码示例

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


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

示例1: Role

# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import purgeGroup [as 别名]
class Role(AbstractRole):
	sessions = {}
	sessions_spooler = None
	
	def __init__(self, main_instance):
		AbstractRole.__init__(self, main_instance)
		self.sessions = {}
		self.locked_sessions = []
		self.sessions_spooler = MPQueue.Queue()
		self.sessions_spooler2 = MPQueue.Queue()
		self.sessions_sync = MPQueue.Queue()
		self.logging_queue = MPQueue.Queue()
		
		self.manager = Manager(self.main_instance.smRequestManager)
		self.threads = []
		
		self.applications = {}
		self.applications_id_SM = {}
		self.applications_mutex = threading.Lock()
		
		self.static_apps = ApplicationsStatic(self.main_instance.smRequestManager)
		self.static_apps_must_synced = False
		self.static_apps_lock = threading.Lock()
		
		self.scripts = Scripts(self.main_instance.smRequestManager)
		self.scripts_lock = threading.Lock()
		self.scripts_must_synced = False
	
	
	def init(self):
		Logger.debug("ApplicationServer init")
		
		try:
			TS.getList()
		except Exception:
			Logger.exception("RDP server dialog failed ... exiting")
			return
		
		if not System.groupExist(self.manager.ts_group_name):
			Logger.error("The group '%s' doesn't exist"%(self.manager.ts_group_name))
			return False
		
		if not System.groupExist(self.manager.ovd_group_name):
			if not System.groupCreate(self.manager.ovd_group_name):
				return False
		
		if not self.manager.purgeGroup():
			Logger.error("Unable to purge group")
			return False
		
		if Config.clean_dump_archive:
			self.purgeArchives()
		
		if Config.thread_count is None:
			cpuInfos = System.getCPUInfos()
			vcpu = cpuInfos[0]
			ram_total = System.getRAMTotal()
			ram = int(round(ram_total / 1024.0 / 1024.0))
			
			nb_thread = int(round(1 + (ram + vcpu * 2)/3))
		else:
			nb_thread = Config.thread_count
		
		Logger._instance.setQueue(self.logging_queue, True)
		for _ in xrange(nb_thread):
			self.threads.append(SessionManagement(self.manager, self.sessions_spooler, self.sessions_spooler2, self.sessions_sync, self.logging_queue))
		
		if self.canManageApplications():
			self.apt = Apt()
			self.apt.init()
			self.threads.append(self.apt)
		
		Logger.info("ApplicationServer:: retrieve all applications installed (can take some time)")
		self.updateApplications()
		
		return True
	
	
	@staticmethod
	def getName():
		return "ApplicationServer"
	
	
	def switch_to_production(self):
		self.setStaticAppsMustBeSync(True)
		self.setScriptsMustBeSync(True)
	
	
	def order_stop(self):
		AbstractRole.order_stop(self)
		
		for session in self.sessions.values():
			self.manager.session_switch_status(session, Session.SESSION_STATUS_WAIT_DESTROY)
			self.spool_action("destroy", session.id)
	
	
	def force_stop(self):
		AbstractRole.force_stop(self)
		
		for thread in self.threads:
#.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:103,代码来源:Role.py


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