# Copyright (c) 2021-2023 Alibaba Cloud Computing Ltd.
# SPDX-License-Identifier: MulanPSL-2.0
import os
import sys
import unittest
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
from common import keentuneInit
class TestKeenTuneUiSmartNormal(unittest.TestCase):
@classmethod
def setUpClass(self, no_ui=False) -> None:
if 'linux' in sys.platform:
option = webdriver.ChromeOptions()
option.add_argument('headless')
option.add_argument('no-sandbox')
option.add_argument('--start-maximized')
option.add_argument('--disable-gpu')
option.add_argument('lang=zh_CN.UTF-8')
option.add_argument('--window-size=1920,1080')
self.driver = webdriver.Chrome(options=option)
self.driver.implicitly_wait(10)
self.wait = WebDriverWait(self.driver, 90, 0.5)
self.AC = ActionChains(self.driver)
else:
if no_ui:
option = webdriver.ChromeOptions()
option.add_argument('headless')
option.add_argument('--start-maximized')
self.driver = webdriver.Chrome(chrome_options=option)
self.wait = WebDriverWait(self.driver, 90, 0.5)
self.AC = ActionChains(self.driver)
else:
self.driver = webdriver.Chrome()
self.driver.maximize_window()
self.wait = WebDriverWait(self.driver, 90, 0.5)
self.AC = ActionChains(self.driver)
keentuneInit(self)
self.driver.get("http://{}:8082/list/tuning-task/".format(self.web_ip))
value = self.driver.find_element(By.XPATH, '//div[@class="ant-pro-table-list-toolbar-title"]').text
if "智能参数调优任务记录" not in value:
self.driver.find_element(By.XPATH,
'//div[@class="ant-space ant-space-horizontal ant-space-align-center right___3L8KG"]/div/div/img').click()
@classmethod
def tearDownClass(self) -> None:
self.driver.get("http://{}:8082/list/tuning-task".format(self.web_ip))
del_list = ["auto_test_HORD", "auto_test_Random", "auto_test2_HORD","auto_test2_Random"]
for i in range(9):
first_text = self.wait.until(
EC.visibility_of_element_located((By.XPATH, '//tbody[@class="ant-table-tbody"]/tr[1]/td[2]'))).text
if first_text in del_list:
self.wait.until(EC.element_to_be_clickable(
(By.XPATH, '//tbody[@class="ant-table-tbody"]/tr[1]/td[12]/div'))).click()
self.wait.until(EC.element_to_be_clickable((By.XPATH,
'//ul[@class="ant-dropdown-menu ant-dropdown-menu-root ant-dropdown-menu-vertical ant-dropdown-menu-light"]/li[6]/span[1]'))).click()
self.wait.until(EC.element_to_be_clickable((By.XPATH,
'//div[@class="ant-modal-confirm-body-wrapper"]//button[@class="ant-btn ant-btn-primary"]'))).click()
sleep(5)
self.driver.quit()
def tearDown(self) -> None:
self.driver.refresh()
sleep(5)
def test_createjob(self):
Algorithm_list = ["HORD", "Random"]
# 遍历创建不同算法任务
for i in Algorithm_list:
self.wait.until(
EC.element_to_be_clickable((By.XPATH, '//button[@class="ant-btn ant-btn-default"]'))).click()
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys("auto_test_" + i)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(i)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.ENTER)
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(10)
self.wait.until(EC.element_to_be_clickable(
(By.XPATH, '//div[@class="ant-modal-mask"]/../div[2]/div[1]/div[2]/div[3]/div[1]/div[2]'))).click()
# 等待任务执行完成,任务完成重新创建下一个,超时则结束
for j in range(1, 9):
sleep(20)
self.driver.refresh()
Total_Time = self.wait.until(
EC.visibility_of_element_located((By.XPATH, '//tbody[@class="ant-table-tbody"]/tr[1]/td[11]'))).text
if Total_Time != "-":
break
elif j == 8:
self.assertNotIn("-", Total_Time)
status = self.wait.until(
EC.visibility_of_element_located((By.XPATH, '//tbody[@class="ant-table-tbody"]/tr[1]/td[4]'))).text
name = self.wait.until(
EC.visibility_of_element_located((By.XPATH, '//tbody[@class="ant-table-tbody"]/tr[1]/td[2]'))).text
if status != 'finish':
print(f'{name} execution failure')
self.assertIn("auto_test_" + Algorithm_list[-1], name)
def test_createjob02(self):
Algorithm_list = ["HORD", "Random"]
# 分别创建不同参数任务
for i in Algorithm_list:
self.wait.until(
EC.element_to_be_clickable((By.XPATH, '//button[@class="ant-btn ant-btn-default"]'))).click()
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "name"))).send_keys("auto_test2_" + i)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(i)
self.wait.until(EC.visibility_of_element_located((By.ID, "algorithm"))).send_keys(Keys.ENTER)
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "iteration"))).send_keys(10)
if i == "TPE":
self.wait.until(EC.visibility_of_element_located((By.ID, "baseline_bench_round"))).send_keys(
Keys.CONTROL, "a")
self.wait.until(EC.visibility_of_element_located((By.ID, "baseline_bench_round"))).send_keys(
Keys.BACKSPACE)
self.wait.until(EC.visibility_of_element_located((By.ID, "baseline_bench_round"))).send_keys(2)
self.wait.until(EC.visibility_of_element_located((By.ID, "tuning_bench_round"))).send_keys(Keys.CONTROL,
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该项目是一款基于AI算法与专家知识库的操作系统全栈式智能优化产品KeenTune的源码,包含326个文件,涵盖130个Go语言文件、89个Python脚本、38个配置文件、20个JSON文件、13个Markdown文件、6个Shell脚本、5个PNG图片文件,以及少量其他文件类型。该产品旨在为各类操作系统提供轻量级、跨平台的性能调优方案,通过智能定制环境助力应用实现最优性能表现。
资源推荐
资源详情
资源评论
收起资源包目录
基于AI算法与专家知识库的操作系统全栈式智能优化设计源码 (331个子文件)
keentuned.conf.5 2KB
keentune-benchmark.7 3KB
keentune-param.7 2KB
keentune-profile.7 2KB
keentune-detect.7 1KB
keentune.8 3KB
keentuned.8 2KB
keentune.bash 2KB
changelog 132B
compat 3B
net_low_latency.conf 3KB
net_high_throuput.conf 3KB
cpu-partitioning.conf 3KB
keentuned.conf 3KB
keentuned.conf 2KB
realtime.conf 2KB
throughput-performance.conf 2KB
accelerator-performance.conf 2KB
postgresql.conf 2KB
nginx.conf 2KB
mysql.conf 2KB
hpc-compute.conf 1KB
io_high_throughput.conf 1KB
latency-performance.conf 1KB
cpu_high_load.conf 1KB
pgsql.conf 879B
spindown-disk.conf 876B
virtual-guest.conf 760B
redis.conf 684B
mssql.conf 681B
oracle.conf 656B
powersave.conf 547B
profile1.conf 532B
profile2.conf 532B
network-throughput.conf 509B
network-latency.conf 393B
balanced.conf 384B
default.conf 350B
virtual-host.conf 342B
atomic-host.conf 318B
atomic-guest.conf 306B
optimize-serial-console.conf 261B
desktop-powersave.conf 260B
ecs-performance.conf 252B
desktop.conf 147B
server-powersave.conf 130B
intel-sst.conf 117B
ecs-guest.conf 83B
control 625B
copyright 782B
format 12B
.gitignore 31B
parameter.go 16KB
assemble.go 13KB
config.go 13KB
check.go 11KB
profile.go 10KB
log.go 10KB
tuner.go 9KB
benchmark.go 9KB
handle.go 9KB
calculator.go 9KB
common.go 9KB
assemble_test.go 8KB
common.go 8KB
parameter_test.go 8KB
init.go 7KB
param.go 7KB
setter.go 7KB
heartbeat.go 7KB
utils.go 6KB
workpath.go 6KB
detect.go 6KB
trainer.go 6KB
method.go 6KB
log_test.go 6KB
benchmark_test.go 6KB
read.go 6KB
common.go 6KB
apply_test.go 6KB
init.go 5KB
init_test.go 5KB
config_test.go 5KB
default.go 5KB
check_test.go 5KB
gocsv.go 5KB
checkinput.go 5KB
configuration.go 5KB
list.go 5KB
file.go 5KB
sensitize.go 4KB
update.go 4KB
jobs.go 4KB
setter_test.go 4KB
apply.go 4KB
tuner_test.go 4KB
api.go 4KB
http.go 3KB
convertdomain.go 3KB
analyse.go 3KB
共 331 条
- 1
- 2
- 3
- 4
资源评论
xyq2024
- 粉丝: 2375
- 资源: 5443
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python实现Excel表格合并
- Java实现读取Excel批量发送邮件.zip
- 【java毕业设计】商城后台管理系统源码(springboot+vue+mysql+说明文档).zip
- 【java毕业设计】开发停车位管理系统(调用百度地图API)源码(springboot+vue+mysql+说明文档).zip
- 星耀软件库(升级版).apk.1
- 基于Django后端和Vue前端的多语言购物车项目设计源码
- 基于Python与Vue的浮光在线教育平台源码设计
- 31129647070291Eclipson MXS R.zip
- 基于Html与Java的会员小程序后台管理系统设计源码
- 基于Python的RabbitMQ消息队列安装使用及脚本开发设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功