This commit is contained in:
dongdonglin(林向东) 2018-10-28 10:02:36 +08:00
commit 79140ca056
6 changed files with 20 additions and 62 deletions

View File

@ -10,7 +10,7 @@ Unless required by applicable law or agreed to in writing, software distributed
import time
import os
from multiprocessing import Process
import threading
from app.dao.time_series_detector import anomaly_op
from app.dao.time_series_detector import sample_op
from app.dao.time_series_detector import train_op
@ -99,8 +99,9 @@ class DetectService(object):
return build_ret_data(LACK_SAMPLE, "")
train_op_obj.insert_train_info(train_params)
try:
process = Process(target=self.__generate_model, args=(samples_list, task_id, ))
process.start()
t = threading.Thread(target=self.__generate_model, args=(samples_list, task_id, ))
t.setDaemon(False)
t.start()
except Exception:
train_status = "failed"
params = {

View File

@ -1,10 +0,0 @@
FROM zhiyunmetis/metis-full
WORKDIR /metis
ADD . /metis
EXPOSE 80
EXPOSE 8080
RUN chmod +x /metis/init.sh
CMD ["/bin/sh","/metis/init.sh"]

View File

@ -1,14 +0,0 @@
/usr/sbin/nginx
nohup /usr/bin/mysqld &
sleep 3
export PYTHONPATH=/metis
sed -i 's/127.0.0.1/9.9.9.9/g' /metis/uweb/dist/app.js
sed -i 's/127.0.0.1/9.9.9.9/g' /metis/uweb/dist/_sample_sampleinfo.js
sleep 3
nohup python /metis/app/controller/manage.py runserver 0.0.0.0:38324 &
/bin/sh

View File

@ -1,9 +1,15 @@
if [ $# == 0 ]
then
echo "Need at least 1 argument!"
exit
echo "Need at least 1 argument!"
exit
fi
ip=$1
sed -i "s/9.9.9.9/${ip}/g" init.sh
docker build -t local/metis-demo:1.0 .
docker run -i -t -p80:80 -p8080:8080 local/metis-demo:1.0
docker rm -f metis-db
docker rm -f metis-svr
docker rm -f metis-web
docker run --net=host --name=metis-db -i -t -d -p 3306:3306 -v /data/metis/mysql/:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=metis@123 zhiyunmetis/metis-db
sleep 6
docker run --net=host --name=metis-svr -i -t -d -p 8080:8080 -v /data/metis/module/:/metis/app/model/time_series_detector zhiyunmetis/metis-svr /bin/sh /metis/init.sh
docker run --net=host --name=metis-web -i -t -d -p 80:80 zhiyunmetis/metis-web /bin/sh /metis/init.sh ${ip}

View File

@ -7,7 +7,7 @@
>> * [服务端环境安装](#chapter-1-3)
>> * [WEB管理端环境安装](#chapter-1-4)
>
> * [docker方式部署](#chapter-2)
> * [docker方式部署](#chapter-2)
>
本安装文档仅描述了在一台服务器上安装搭建整个Metis的过程目的是为了让用户对Metis的部署搭建、运行等整体认识。
@ -18,11 +18,11 @@
| 软件 | 软件要求 |
| --- | --- |
| linux内核版本:| CentOS 7.4 |
| linux发行版:| CentOS 7.4 |
| python版本:| 2.7版本|
| MySQL版本:| 5.6.26及以上版本|
| Node.js版本:| 8.11.1及以上版本|s
| Django版本:| 1.11.13及以上版本|
| Django版本:| 1.x.x 版本|
运行服务器要求1台普通安装linux系统的机器即可推荐CentOS系统服务器需要开放80和8080端口
@ -46,7 +46,7 @@ systemctl start mariadb
1、创建需要的数据库用户名并授权连接MySQL客户端并执行
```
grant all privileges on *.* to metis@127.0.0.1 identified by 'metis@123';
grant all privileges on metis.* to metis@127.0.0.1 identified by 'metis@123';
flush privileges;
```
@ -188,4 +188,4 @@ service docker start
```
Metis/docker/start.sh ${IP}
```
等待部署完成后,可以通过浏览器直接访问: `http://${IP}`
等待部署完成后,可以通过浏览器直接访问: `http://${IP}`

View File

@ -1,25 +0,0 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Tencent is pleased to support the open source community by making Metis available.
Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://opensource.org/licenses/BSD-3-Clause
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
"""
from tests.fixtures import DataTestCase
from app.config.common import *
from app.utils.utils import *
class CommonTestCase(DataTestCase):
def test_check_value(self):
str_param = self.generate_random_str(INPUT_LEN_ENG_MAX+1)
self.assertTrue(validate_value(str_param) != 0 )
list_param = []
for i in range(0,INPUT_LIST_LEN_MAX):
list_param.append(self.generate_random_str(INPUT_LEN_ENG_MAX))
self.assertTrue(validate_value(list_param) == 0 )
list_param.append(self.generate_random_str(INPUT_LEN_ENG_MAX))
self.assertFalse(validate_value(list_param) == 0 )