diff --git a/Makefile b/Makefile index 9d0129e787e1587ab6fc63b027a5c032fccb53e0..68f62526e49d105c756b29f0b61e46ad81e41215 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 0.2 +VERSION = 0.3 .PHONY: all clean modules PKGPATH=pkg @@ -13,7 +13,7 @@ ATUNEVERSION = $(VERSION)$(if $(SRCVERSION),($(SRCVERSION))) GOLDFLAGS += -X gitee.com/openeuler/A-Tune/common/config.Version=$(ATUNEVERSION) GOFLAGS = -ldflags "$(GOLDFLAGS)" -CERT_PATH=/etc/atuned +CERT_PATH=$(DESTDIR)/etc/atuned GRPC_CERT_PATH=$(CERT_PATH)/grpc_certs REST_CERT_PATH=$(CERT_PATH)/rest_certs ENGINE_CERT_PATH=$(CERT_PATH)/engine_certs @@ -80,6 +80,7 @@ libinstall: install -m 750 pkg/atuned $(BINDIR) install -m 640 misc/atuned.service $(SYSTEMDDIR) install -m 640 misc/atuned.cnf $(DESTDIR)/etc/atuned/ + install -m 640 misc/engine.cnf $(DESTDIR)/etc/atuned/ install -m 640 rules/tuning/tuning_rules.grl $(DESTDIR)/etc/atuned/rules install -m 640 misc/atune-engine.service $(SYSTEMDDIR) install -m 640 database/atuned.db $(DESTDIR)/var/lib/atuned/ @@ -91,13 +92,13 @@ libinstall: \cp -rf resources/* $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/resources/ chmod -R 750 $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/resources/ \cp -rf profiles/* $(DESTDIR)$(PREFIX)/lib/atuned/profiles/ - chmod -R 640 $(DESTDIR)$(PREFIX)/lib/atuned/profiles/ + chmod -R 750 $(DESTDIR)$(PREFIX)/lib/atuned/profiles/ @echo "END INSTALL A-Tune" rpm: - cd .. && tar -zcvf openeuler-A-Tune-v$(VERSION).tar.gz A-Tune + cd .. && tar -zcvf v$(VERSION).tar.gz A-Tune mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - mv ../openeuler-A-Tune-v$(VERSION).tar.gz ~/rpmbuild/SOURCES + mv ../v$(VERSION).tar.gz ~/rpmbuild/SOURCES rpmbuild -ba misc/atune.spec models: diff --git a/README.md b/README.md index ce825d741fb9df305d85c5d6d72677b7902f9008..27e53d7969b20cfc4c1fba93d16cbe8034e554f2 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ yum install -y python3-dict2xml python3-flask-restful python3-pandas python3-sci ``` Or ```bash -pip3 install dict2xml Flask-RESTful pandas scikit-optimize==0.5.2 xgboost==0.90 scikit-learn==0.20.4 +pip3 install dict2xml Flask-RESTful pandas scikit-optimize xgboost scikit-learn ``` #### 3. Download the source code. @@ -42,6 +42,7 @@ git clone https://gitee.com/openeuler/A-Tune.git #### 4. Compile. ```bash cd A-Tune +make models make ``` diff --git a/misc/atune-engine.service b/misc/atune-engine.service index 62e166e62adada8f2bc6638b438835540ed11265..96d891fbdf6e2ad1dec85410270e5f4ff77ab286 100644 --- a/misc/atune-engine.service +++ b/misc/atune-engine.service @@ -4,7 +4,7 @@ After=network.target Requires=polkit.service [Service] -ExecStart=python3 /usr/libexec/atuned/analysis/app_engine.py /etc/atuned/atuned.cnf +ExecStart=python3 /usr/libexec/atuned/analysis/app_engine.py /etc/atuned/engine.cnf [Install] WantedBy=multi-user.target diff --git a/misc/atune.spec b/misc/atune.spec index 648781fc5dd6089da57e08a882440420706e3b44..1da9e7735bbb5b1a9f9b24990da1bbae69331c08 100755 --- a/misc/atune.spec +++ b/misc/atune.spec @@ -2,20 +2,22 @@ Summary: AI auto tuning system Name: atune -Version: 0.2 +Version: 0.3 Release: 0.1 License: Mulan PSL v2 URL: https://gitee.com/openeuler/A-Tune -Source: openeuler-A-Tune-v%{version}.tar.gz +Source: https://gitee.com/openeuler/A-Tune/repository/archive/v%{version}.tar.gz -BuildRequires: rpm-build protobuf-compiler golang-bin python3-pytest procps-ng +BuildRequires: rpm-build golang-bin procps-ng BuildRequires: sqlite >= 3.24.0 openssl +BuildRequires: python3-scikit-optimize python3-pandas python3-xgboost Requires: systemd Requires: atune-client Requires: atune-db Requires: python3-dict2xml Requires: python3-flask-restful Requires: python3-pandas +Requires: python3-lhsmdu Requires: prefetch_tuning Requires: perf Requires: sysstat @@ -56,6 +58,10 @@ atune engine tool for manage atuned AI tuning system. %autosetup -n A-Tune -p1 %build +sed -i "s/^rest_tls.*/rest_tls = false/" misc/atuned.cnf +sed -i "s/^engine_tls.*/engine_tls = false/" misc/atuned.cnf +sed -i "s/^engine_tls.*/engine_tls = false/" misc/engine.cnf +make models %make_build %install @@ -78,14 +84,17 @@ atune engine tool for manage atuned AI tuning system. %exclude /usr/libexec/atuned/analysis/engine/ %attr(0750,root,root) %dir /usr/lib/atuned %attr(0750,root,root) %dir /usr/lib/atuned/modules -%attr(0640,root,root) %dir /usr/lib/atuned/profiles +%attr(0750,root,root) %dir /usr/lib/atuned/profiles %attr(0750,root,root) %dir /usr/libexec/atuned %attr(0750,root,root) %dir /usr/libexec/atuned/scripts %attr(0750,root,root) %dir /usr/libexec/atuned/analysis %attr(0750,root,root) %dir /usr/share/atuned -%attr(0640,root,root) %dir /etc/atuned -%attr(0640,root,root) %dir /var/atuned -%attr(0640,root,root) /etc/atuned/* +%attr(0750,root,root) %dir /etc/atuned +%attr(0750,root,root) %dir /etc/atuned/rules +%attr(0750,root,root) %dir /var/atuned +%attr(0640,root,root) /etc/atuned/atuned.cnf +%exclude /etc/atuned/engine_certs/* +%exclude /etc/atuned/rest_certs/* %files client %attr(0750,root,root) %{_bindir}/atune-adm @@ -112,7 +121,11 @@ atune engine tool for manage atuned AI tuning system. %exclude /usr/libexec/atuned/analysis/atuned/ %attr(0750,root,root) %dir /usr/libexec/atuned/analysis %attr(0750,root,root) %dir /usr/libexec/atuned/resources -%attr(0640,root,root) %dir /etc/atuned +%attr(0750,root,root) %dir /etc/atuned +%exclude /etc/atuned/atuned.cnf +%exclude /etc/atuned/rules +%exclude /etc/atuned/engine_certs/* +%exclude /etc/atuned/rest_certs/* %post %systemd_post atuned.service diff --git a/misc/atuned.cnf b/misc/atuned.cnf index a78a982627e4876b0611eb1cd90808f9e402493a..dad7f586a5ac03a38c7d45b4aac346d537b3c329 100755 --- a/misc/atuned.cnf +++ b/misc/atuned.cnf @@ -67,8 +67,6 @@ engine_tls = true tlsenginecacertfile = /etc/atuned/engine_certs/ca.crt tlsengineclientcertfile = /etc/atuned/engine_certs/client.crt tlsengineclientkeyfile = /etc/atuned/engine_certs/client.key -tlsengineservercertfile = /etc/atuned/engine_certs/server.crt -tlsengineserverkeyfile = /etc/atuned/engine_certs/server.key #################################### log ############################### [log] diff --git a/misc/engine.cnf b/misc/engine.cnf new file mode 100755 index 0000000000000000000000000000000000000000..192783d80ed62382a12307056933bcdbd42c57b5 --- /dev/null +++ b/misc/engine.cnf @@ -0,0 +1,30 @@ +# Copyright (c) 2019 Huawei Technologies Co., Ltd. +# A-Tune is licensed under the Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# http://license.coscl.org.cn/MulanPSL2 +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR +# PURPOSE. +# See the Mulan PSL v2 for more details. +# Create: 2020-9-4 + +#################################### engine ############################### +[server] +# the tuning optimizer host and port, start by engine.service +# if engine_host is same as rest_host, two ports cannot be same +# the port can be set between 0 to 65535 which not be used +engine_host = localhost +engine_port = 3838 + +# enable engine server authentication SSL/TLS +# default is true +engine_tls = true +tlsenginecacertfile = /etc/atuned/engine_certs/ca.crt +tlsengineservercertfile = /etc/atuned/engine_certs/server.crt +tlsengineserverkeyfile = /etc/atuned/engine_certs/server.key + +#################################### log ############################### +[log] +# either "debug", "info", "warn", "error", "critical", default is "info" +level = info diff --git a/resources/web.py b/resources/web.py index 2d52e6cbb6641270be53a05e2b1a46b7402228c4..5b7cfda073c75a1ad0da1758e738731608833db1 100644 --- a/resources/web.py +++ b/resources/web.py @@ -105,5 +105,5 @@ def update_tuning_page(prj_name, num, timestamp, _): if __name__ == '__main__': config = ConfigParser() - config.read('/etc/atuned/atuned.cnf') + config.read('/etc/atuned/engine.cnf') socketio.run(APP, host=config.get("server", "engine_host"), port=10086)