當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。