本文整理汇总了Python中ovd.Platform.System.System.getRAMTotal方法的典型用法代码示例。如果您正苦于以下问题:Python System.getRAMTotal方法的具体用法?Python System.getRAMTotal怎么用?Python System.getRAMTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovd.Platform.System.System
的用法示例。
在下文中一共展示了System.getRAMTotal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: req_server_conf
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getRAMTotal [as 别名]
def req_server_conf(self, request):
cpuInfos = System.getCPUInfos()
ram_total = System.getRAMTotal()
doc = Document()
rootNode = doc.createElement('configuration')
rootNode.setAttribute("type", System.getName())
rootNode.setAttribute("version", System.getVersion())
rootNode.setAttribute("ram", str(ram_total))
rootNode.setAttribute("ulteo_system", str(self.server.ulteo_system).lower())
cpuNode = doc.createElement('cpu')
cpuNode.setAttribute('nb_cores', str(cpuInfos[0]))
textNode = doc.createTextNode(cpuInfos[1])
cpuNode.appendChild(textNode)
rootNode.appendChild(cpuNode)
for role,dialog in self.server.role_dialogs:
roleNode = doc.createElement('role')
roleNode.setAttribute('name', dialog.getName())
rootNode.appendChild(roleNode)
doc.appendChild(rootNode)
return self.req_answer(doc)
示例2: init
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getRAMTotal [as 别名]
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