From e0666689e587f35784af10c59c96ea224c06ecb6 Mon Sep 17 00:00:00 2001
From: pycook <pycook@126.com>
Date: Tue, 8 Aug 2023 13:16:07 +0800
Subject: [PATCH] upgrade celery

---
 Makefile                      |   2 +-
 cmdb-api/Pipfile              |   8 +--
 cmdb-api/api/app.py           |   2 +-
 cmdb-api/api/lib/perm/auth.py |  15 ++--
 cmdb-api/celery_worker.py     |   2 +-
 cmdb-api/requirements.txt     |  41 ++---------
 cmdb-api/settings.example.py  |  11 +--
 docs/cmdb.sql                 | 130 +---------------------------------
 docs/local.md                 |   4 +-
 docs/local_en.md              |   4 +-
 10 files changed, 31 insertions(+), 188 deletions(-)

diff --git a/Makefile b/Makefile
index 99b1122..aa01399 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ api:
 	cd cmdb-api && pipenv run flask run -h 0.0.0.0
 
 worker:
-	cd cmdb-api && pipenv run celery worker -A celery_worker.celery -E -Q one_cmdb_async --concurrency=1 -D && pipenv run celery worker -A celery_worker.celery -E -Q acl_async --concurrency=1 -D
+	cd cmdb-api && pipenv run celery -A celery_worker.celery worker -E -Q one_cmdb_async --concurrency=1 -D && pipenv run celery -A celery_worker.celery worker -E -Q acl_async --concurrency=1 -D
 
 ui:
 	cd cmdb-ui && yarn run serve
diff --git a/cmdb-api/Pipfile b/cmdb-api/Pipfile
index 7c4ca41..901072e 100644
--- a/cmdb-api/Pipfile
+++ b/cmdb-api/Pipfile
@@ -14,7 +14,7 @@ Flask-RESTful = "==0.3.10"
 Flask-SQLAlchemy = "==2.5.0"
 SQLAlchemy = "==1.4.49"
 PyMySQL = "==1.1.0"
-redis = "==3.2.1"
+redis = "==4.6.0"
 # Migrations
 Flask-Migrate = "==2.5.2"
 # Deployment
@@ -32,10 +32,10 @@ Flask-Caching = ">=1.0.0"
 environs = "==4.2.0"
 marshmallow = "==2.20.2"
 # async tasks
-celery = "==4.3.0"
+celery = "==5.3.1"
 celery_once = "==3.0.1"
 more-itertools = "==5.0.0"
-kombu = "==4.4.0"
+kombu = "==5.3.1"
 # common setting
 timeout-decorator = "==0.5.0"
 WTForms = "==3.0.0"
@@ -50,7 +50,7 @@ toposort = ">=1.5"
 requests = ">=2.22.0"
 PyJWT = "==2.4.0"
 elasticsearch = "==7.17.9"
-future = "==0.18.2"
+future = "==0.18.3"
 itsdangerous = "==2.1.2"
 Jinja2 = "==3.1.2"
 jinja2schema = "==0.1.4"
diff --git a/cmdb-api/api/app.py b/cmdb-api/api/app.py
index 4df68fc..5c2ca7a 100644
--- a/cmdb-api/api/app.py
+++ b/cmdb-api/api/app.py
@@ -129,7 +129,7 @@ def register_extensions(app):
     rd.init_app(app)
     if app.config.get('USE_ES'):
         es.init_app(app)
-    celery.conf.update(app.config)
+    celery.conf.update(app.config.get('CELERY'))
 
 
 def register_blueprints(app):
diff --git a/cmdb-api/api/lib/perm/auth.py b/cmdb-api/api/lib/perm/auth.py
index 3b999ef..327af69 100644
--- a/cmdb-api/api/lib/perm/auth.py
+++ b/cmdb-api/api/lib/perm/auth.py
@@ -7,10 +7,8 @@ from functools import wraps
 import jwt
 from flask import abort
 from flask import current_app
-from flask import g
 from flask import request
 from flask import session
-from flask_login import current_user
 from flask_login import login_user
 
 from api.lib.perm.acl.acl import ACLManager
@@ -65,12 +63,10 @@ def _auth_with_key():
 
 
 def _auth_with_session():
-    if isinstance(getattr(g, 'user', None), User):
-        login_user(current_user)
-        return True
     if "acl" in session and "userName" in (session["acl"] or {}):
         login_user(UserCache.get(session["acl"]["userName"]))
         return True
+
     return False
 
 
@@ -158,9 +154,12 @@ def _auth_with_acl_token():
 
 
 def auth_required(func):
-    if request.json is not None:
-        setattr(request, 'values', request.json)
-    else:
+    try:
+        if request.json is not None:
+            setattr(request, 'values', request.json)
+        else:
+            setattr(request, 'values', request.values.to_dict())
+    except:
         setattr(request, 'values', request.values.to_dict())
 
     @wraps(func)
diff --git a/cmdb-api/celery_worker.py b/cmdb-api/celery_worker.py
index 5692141..5f6dbbd 100644
--- a/cmdb-api/celery_worker.py
+++ b/cmdb-api/celery_worker.py
@@ -3,7 +3,7 @@
 from api.app import create_app
 from api.extensions import celery
 
-# celery worker -A celery_worker.celery -l DEBUG -E -Q xxxx
+# celery -A celery_worker.celery worker -l DEBUG -E -Q xxxx
 
 app = create_app()
 app.app_context().push()
diff --git a/cmdb-api/requirements.txt b/cmdb-api/requirements.txt
index be049a2..ac5cf22 100644
--- a/cmdb-api/requirements.txt
+++ b/cmdb-api/requirements.txt
@@ -1,20 +1,9 @@
 -i https://mirrors.aliyun.com/pypi/simple
 alembic==1.7.7
-amqp==2.6.1
-aniso8601==9.0.1
-attrs==23.1.0
-backports.zoneinfo==0.2.1
-bcrypt==4.0.1
-beautifulsoup4==4.12.2
-billiard==3.6.4.0
 bs4==0.0.1
-cachelib==0.9.0
-celery==4.3.0
+celery==5.3.1
 celery-once==3.0.1
-certifi==2023.7.22
-charset-normalizer==3.1.0
 click==8.1.3
-dnspython==2.3.0
 elasticsearch==7.17.9
 email-validator==1.3.1
 environs==4.2.0
@@ -27,51 +16,31 @@ Flask-Login==0.6.2
 Flask-Migrate==2.5.2
 Flask-RESTful==0.3.10
 Flask-SQLAlchemy==2.5.0
-future==0.18.2
+future==0.18.3
 gunicorn==21.0.1
-idna==3.4
-importlib-metadata==6.8.0
-importlib-resources=
-=6.0.0
 itsdangerous==2.1.2
 Jinja2==3.1.2
 jinja2schema==0.1.4
 jsonschema==4.18.0
-jsonschema-specifications==2023.6.1
-kombu==4.4.0
+kombu==5.3.1
 Mako==1.2.4
 MarkupSafe==2.1.3
 marshmallow==2.20.2
-meld3==2.0.1
-mistune==3.0.1
 more-itertools==5.0.0
 msgpack-python==0.5.6
 Pillow==9.3.0
-pkgutil_resolve_name==1.3.10
-pyasn1==0.5.0
-pyasn1-modules==0.3.0
 pycryptodome==3.12.0
 PyJWT==2.4.0
 PyMySQL==1.1.0
-python-dateutil==2.8.2
-python-dotenv==1.0.0
 python-ldap==3.4.0
-pytz==2023.3
 PyYAML==6.0
-redis==3.2.1
-referencing==0.29.1
+redis==4.6.0
 requests==2.31.0
-rpds-py==0.8.8
 six==1.12.0
-soupsieve==2.4.1
 SQLAlchemy==1.4.49
 supervisor==4.0.3
 timeout-decorator==0.5.0
 toposort==1.10
 treelib==1.6.1
-tzlocal==5.0.1
-urllib3==1.26.16
-vine==1.3.0
 Werkzeug==2.3.6
-WTForms==3.0.0
-zipp==3.16.0
\ No newline at end of file
+WTForms==3.0.0
\ No newline at end of file
diff --git a/cmdb-api/settings.example.py b/cmdb-api/settings.example.py
index fc22f59..ce66b4b 100644
--- a/cmdb-api/settings.example.py
+++ b/cmdb-api/settings.example.py
@@ -53,13 +53,16 @@ MAIL_PASSWORD = ''
 DEFAULT_MAIL_SENDER = ''
 
 # # queue
-CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/2"
-BROKER_URL = 'redis://127.0.0.1:6379/2'
-BROKER_VHOST = '/'
+CELERY = {
+    "broker_url": 'redis://127.0.0.1:6379/2',
+    "result_backend": "redis://127.0.0.1:6379/2",
+    "broker_vhost": "/",
+    "broker_connection_retry_on_startup": True
+}
 ONCE = {
     'backend': 'celery_once.backends.Redis',
     'settings': {
-        'url': BROKER_URL,
+        'url': CELERY['broker_url'],
     }
 }
 
diff --git a/docs/cmdb.sql b/docs/cmdb.sql
index feeaa4e..aa6d672 100644
--- a/docs/cmdb.sql
+++ b/docs/cmdb.sql
@@ -650,7 +650,7 @@ CREATE TABLE `c_ad_ci_types` (
   KEY `ix_c_ad_ci_types_uid` (`uid`),
   KEY `ix_c_ad_ci_types_agent_id` (`agent_id`),
   KEY `ix_c_ad_ci_types_deleted` (`deleted`),
-  CONSTRAINT `c_ad_ci_types_ibfk2` FOREIGN KEY (`adr_id`) REFERENCES `c_adr` (`id`),
+  CONSTRAINT `c_ad_ci_types_ibfk2` FOREIGN KEY (`adr_id`) REFERENCES `c_ad_rules` (`id`),
   CONSTRAINT `c_ad_ci_types_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `c_ci_types` (`id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
@@ -705,134 +705,6 @@ INSERT INTO `c_ad_rules` VALUES (NULL,0,'2023-07-11 16:57:01',NULL,1,'阿里云'
 /*!40000 ALTER TABLE `c_ad_rules` ENABLE KEYS */;
 UNLOCK TABLES;
 
---
--- Table structure for table `c_adc`
---
-
-DROP TABLE IF EXISTS `c_adc`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `c_adc` (
-  `deleted_at` datetime DEFAULT NULL,
-  `deleted` tinyint(1) DEFAULT NULL,
-  `created_at` datetime DEFAULT NULL,
-  `updated_at` datetime DEFAULT NULL,
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `a` int(11) DEFAULT NULL,
-  `b` int(11) DEFAULT NULL,
-  `unique_value` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
-  `c` json DEFAULT NULL,
-  `d` int(11) DEFAULT NULL,
-  `e` tinyint(1) DEFAULT NULL,
-  `f` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
-  `g` datetime DEFAULT NULL,
-  PRIMARY KEY (`id`),
-  KEY `a` (`a`),
-  KEY `b` (`b`),
-  KEY `ix_c_adc_d` (`d`),
-  KEY `ix_c_adc_f` (`f`),
-  KEY `ix_c_adc_unique_value` (`unique_value`),
-  KEY `ix_c_adc_deleted` (`deleted`),
-  CONSTRAINT `c_adc_ibfk_1` FOREIGN KEY (`a`) REFERENCES `c_ci_types` (`id`),
-  CONSTRAINT `c_adc_ibfk_2` FOREIGN KEY (`b`) REFERENCES `c_adt` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `c_adc`
---
-
-LOCK TABLES `c_adc` WRITE;
-/*!40000 ALTER TABLE `c_adc` DISABLE KEYS */;
-INSERT INTO `c_adc` VALUES (NULL,0,'2023-05-11 16:14:59','2023-05-23 17:47:17',20,28,1,'21980106042SHC600012','{\"sn\": \"21980106042SHC600012\", \"ips\": [\"146.242.2.234\", \"192.168.3.85\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.3.85\", \"unique_key\": \"sn\", \"description\": \"S5720S-52X-LI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.170 (S5720 V200R021C00SPC100) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"HUAWEI S5720 Routing Switch\", \"device_model\": \"2011.2.23.429\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:17'),(NULL,0,'2023-05-11 16:15:00','2023-05-23 17:47:17',22,28,1,'2102350HND9WJ3000319','{\"sn\": \"2102350HND9WJ3000319\", \"ips\": [\"169.254.3.1\", \"192.168.1.3\", \"192.168.3.95\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.1.3\", \"unique_key\": \"sn\", \"description\": \"Huawei AC6003-8 Huawei Versatile Routing Platform Software  VRP (R) software,Version 5.170 (AC6003-8 V200R019C00SPC500) Copyright (C) 2011-2020 Huawei Technologies Co., Ltd\", \"device_name\": \"AC6003-8\", \"device_model\": \"2011.2.240.12\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:17'),(NULL,0,'2023-05-11 16:15:00','2023-05-23 17:47:17',23,28,1,'102130117737','{\"sn\": \"102130117737\", \"ips\": [\"10.86.21.1\", \"20.86.21.1\", \"192.168.1.1\", \"192.168.3.1\", \"192.168.10.1\", \"192.168.20.1\", \"192.168.21.1\", \"192.168.25.1\", \"192.168.28.1\", \"192.168.29.1\", \"192.168.126.1\", \"192.168.127.253\", \"192.168.138.1\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"10.86.21.1\", \"unique_key\": \"sn\", \"description\": \"S6730S-H24X6C-A \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.170 (S6730 V200R021C00SPC100) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"HUAWEI S6730 Routing Switch\", \"device_model\": \"2011.2.23.763\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:17'),(NULL,0,'2023-05-11 16:15:00','2023-05-23 17:47:16',24,28,1,'2102359589DMH1000063','{\"sn\": \"2102359589DMH1000063\", \"ips\": [\"192.168.1.6\", \"192.168.3.82\", \"192.168.126.6\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.1.6\", \"unique_key\": \"sn\", \"description\": \"S5720-52X-EI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.170 (S5720 V200R019C10SPC500) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"HUAWEI S5720 Routing Switch\", \"device_model\": \"2011.2.23.306\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:16'),(NULL,0,'2023-05-11 16:15:00','2023-05-23 17:47:16',27,28,1,'21980105972SHA600431','{\"sn\": \"21980105972SHA600431\", \"ips\": [\"192.168.1.8\", \"192.168.126.8\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.1.8\", \"unique_key\": \"sn\", \"description\": \"S5720S-28X-PWR-LI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.170 (S5720 V200R021C00SPC100) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"HUAWEI S5720 Routing Switch\", \"device_model\": \"2011.2.23.422\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:16'),(NULL,0,'2023-05-11 16:15:59','2023-05-23 17:47:16',28,28,1,'2102352360W0EC001814','{\"sn\": \"2102352360W0EC001814\", \"ips\": [\"10.172.130.9\", \"10.172.131.9\", \"10.172.132.9\", \"10.172.133.9\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"10.172.130.9\", \"unique_key\": \"sn\", \"description\": \"S5700-24TP-SI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.150 (S5700 V200R005C00SPC500) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"Quidway S5700 Routing Switch\", \"device_model\": \"2011.2.23.145\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:16'),(NULL,0,'2023-05-11 16:15:59','2023-05-23 17:47:16',30,28,1,'2102352360W0F4000579','{\"sn\": \"2102352360W0F4000579\", \"ips\": [\"10.86.21.10\", \"192.168.1.5\", \"192.168.3.91\", \"192.168.29.5\", \"192.168.126.5\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.1.5\", \"unique_key\": \"sn\", \"description\": \"S5700-24TP-SI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.150 (S5700 V200R005C00SPC500) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"Quidway S5700 Routing Switch\", \"device_model\": \"2011.2.23.145\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:16'),(NULL,0,'2023-05-11 16:16:00','2023-05-23 17:47:16',32,28,1,'2102352360W0F2000671','{\"sn\": \"2102352360W0F2000671\", \"ips\": [\"192.168.1.7\", \"192.168.3.90\", \"192.168.29.7\", \"192.168.126.7\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.1.7\", \"unique_key\": \"sn\", \"description\": \"S5700-24TP-SI-AC \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.150 (S5700 V200R005C00SPC500) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"Quidway S5700 Routing Switch\", \"device_model\": \"2011.2.23.145\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 17:47:16'),(NULL,0,'2023-05-11 16:16:00','2023-05-23 19:18:34',33,28,1,'102190453258','{\"sn\": \"102190453258\", \"ips\": [\"10.172.135.254\", \"58.33.167.78\", \"112.64.24.202\", \"192.168.0.1\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"10.172.135.254\", \"unique_key\": \"sn\", \"description\": \"Huawei Versatile Routing Platform Software\\r\\nSoftware Version: VRP (R) Software, Version 5.170 USG6300E V600R007C20SPC300\\r\\nCopyright (C) 2014-2021 Huawei Technologies Co., Ltd.\\r\\n\", \"device_name\": \"USG6305E\", \"device_model\": \"2011.2.321.1.198\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 19:18:34'),(NULL,0,'2023-05-11 16:16:00','2023-05-23 19:18:34',34,28,1,'W02160041614','{\"sn\": \"W02160041614\", \"ips\": [\"192.168.1.253\", \"192.168.3.81\", \"192.168.138.81\"], \"status\": \"\", \"ci_type\": \"switch\", \"manager_ip\": \"192.168.3.81\", \"unique_key\": \"sn\", \"description\": \"S5731S-H24T4XC-A \\r\\nHuawei Versatile Routing Platform Software \\r\\n VRP (R) software,Version 5.170 (S5731 V200R021C00SPC100) \\r\\n Copyright (C) 2007 Huawei Technologies Co., Ltd.\", \"device_name\": \"HUAWEI S5731 Routing Switch\", \"device_model\": \"2011.2.23.705\", \"manufacturer\": \"HUAWEI Technology Co.,Ltd\"}',NULL,1,'admin','2023-05-23 19:18:34');
-/*!40000 ALTER TABLE `c_adc` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `c_adr`
---
-
-DROP TABLE IF EXISTS `c_adr`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `c_adr` (
-  `deleted_at` datetime DEFAULT NULL,
-  `deleted` tinyint(1) DEFAULT NULL,
-  `created_at` datetime DEFAULT NULL,
-  `updated_at` datetime DEFAULT NULL,
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `a` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
-  `b` enum('http','snmp','agent') COLLATE utf8_unicode_ci DEFAULT NULL,
-  `c` tinyint(1) DEFAULT NULL,
-  `d` int(11) DEFAULT NULL,
-  `e` json DEFAULT NULL,
-  `f` json DEFAULT NULL,
-  `g` tinyint(1) DEFAULT NULL,
-  `h` text COLLATE utf8_unicode_ci,
-  `i` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
-  PRIMARY KEY (`id`),
-  KEY `ix_c_adr_d` (`d`),
-  KEY `ix_c_adr_c` (`c`),
-  KEY `ix_c_adr_deleted` (`deleted`),
-  KEY `ix_c_adr_b` (`b`)
-) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `c_adr`
---
-
-LOCK TABLES `c_adr` WRITE;
-/*!40000 ALTER TABLE `c_adr` DISABLE KEYS */;
-INSERT INTO `c_adr` VALUES (NULL,0,'2023-05-23 11:14:22',NULL,1,'阿里云','http',1,NULL,'{\"icon\": {\"name\": \"caise-aliyun\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,2,'腾讯云','http',1,NULL,'{\"icon\": {\"name\": \"caise-tengxunyun\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,3,'华为云','http',1,NULL,'{\"icon\": {\"name\": \"caise-huaweiyun\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,4,'AWS','http',1,NULL,'{\"icon\": {\"name\": \"caise-aws\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,5,'交换机','snmp',1,NULL,'{\"icon\": {\"name\": \"caise-jiaohuanji\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,6,'路由器','snmp',1,NULL,'{\"icon\": {\"name\": \"caise-luyouqi\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,7,'防火墙','snmp',1,NULL,'{\"icon\": {\"name\": \"caise-fanghuoqiang\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 11:14:22',NULL,8,'打印机','snmp',1,NULL,'{\"icon\": {\"name\": \"caise-dayinji\"}}',NULL,0,NULL,NULL),(NULL,0,'2023-05-23 14:43:42',NULL,9,'物理机','agent',1,NULL,'{\"icon\": {\"name\": \"caise-wuliji\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:43:52',NULL,10,'虚拟机','agent',1,NULL,'{\"icon\": {\"name\": \"caise-xuniji\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:44:08',NULL,11,'网卡','agent',1,NULL,'{\"icon\": {\"name\": \"caise-wangka\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:44:18',NULL,12,'硬盘','agent',1,NULL,'{\"icon\": {\"name\": \"caise-yingpan\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:44:53',NULL,13,'MySQL','agent',1,NULL,'{\"icon\": {\"name\": \"caise-mySQL\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:45:06',NULL,14,'MongoDB','agent',1,NULL,'{\"icon\": {\"name\": \"caise-mongodb\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:45:27',NULL,15,'MSSQL','agent',1,NULL,'{\"icon\": {\"name\": \"caise-SQLServer\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:45:43',NULL,16,'Nginx','agent',1,NULL,'{\"icon\": {\"name\": \"caise-nginx\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:45:54',NULL,17,'Tomcat','agent',1,NULL,'{\"icon\": {\"name\": \"caise-tomcat\", \"color\": \"\"}}','[]',0,NULL,NULL),(NULL,0,'2023-05-23 14:46:12',NULL,18,'Apache','agent',1,NULL,'{\"icon\": {\"name\": \"caise-apache\", \"color\": \"\"}}','[]',0,NULL,NULL);
-/*!40000 ALTER TABLE `c_adr` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `c_adt`
---
-
-DROP TABLE IF EXISTS `c_adt`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `c_adt` (
-  `deleted_at` datetime DEFAULT NULL,
-  `deleted` tinyint(1) DEFAULT NULL,
-  `created_at` datetime DEFAULT NULL,
-  `updated_at` datetime DEFAULT NULL,
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `a` int(11) DEFAULT NULL,
-  `b` int(11) DEFAULT NULL,
-  `c` json DEFAULT NULL,
-  `d` json DEFAULT NULL,
-  `e` tinyint(1) DEFAULT NULL,
-  `f` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
-  `g` text COLLATE utf8_unicode_ci,
-  `h` int(11) DEFAULT NULL,
-  `i` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
-  `j` json DEFAULT NULL,
-  `k` int(11) DEFAULT NULL,
-  PRIMARY KEY (`id`),
-  KEY `a` (`a`),
-  KEY `b` (`b`),
-  KEY `ix_c_adt_deleted` (`deleted`),
-  KEY `ix_c_adt_k` (`k`),
-  KEY `ix_c_adt_f` (`f`),
-  CONSTRAINT `c_adt_ibfk_1` FOREIGN KEY (`a`) REFERENCES `c_ci_types` (`id`),
-  CONSTRAINT `c_adt_ibfk_2` FOREIGN KEY (`b`) REFERENCES `c_adr` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `c_adt`
---
-
-LOCK TABLES `c_adt` WRITE;
-/*!40000 ALTER TABLE `c_adt` DISABLE KEYS */;
-INSERT INTO `c_adt` VALUES (NULL,0,'2023-05-23 14:47:58','2023-05-23 15:18:32',1,28,5,'{\"sn\": \"switch_sn\", \"ips\": \"ips\", \"manager_ip\": \"manage_ip\", \"description\": \"description\", \"device_name\": \"netdev_name\", \"device_model\": \"netdev_type\", \"manufacturer\": \"netdev_manufacturer1\"}',NULL,0,'0x1111','',3600,NULL,'{\"nodes\": [{\"id\": \"09973a8f-9347-446e-9700-388cc430da01\", \"ip\": \"\", \"version\": \"\", \"community\": \"\"}]}',1),(NULL,0,'2023-05-23 14:48:15',NULL,2,29,6,NULL,NULL,0,NULL,NULL,3600,NULL,NULL,1),(NULL,0,'2023-05-23 14:48:24',NULL,3,30,7,NULL,NULL,0,NULL,NULL,3600,NULL,NULL,1),(NULL,0,'2023-05-23 17:27:21',NULL,4,4,9,NULL,NULL,0,NULL,NULL,300,NULL,NULL,1);
-/*!40000 ALTER TABLE `c_adt` ENABLE KEYS */;
-UNLOCK TABLES;
-
 --
 -- Table structure for table `c_attribute_histories`
 --
diff --git a/docs/local.md b/docs/local.md
index c01400c..7083331 100644
--- a/docs/local.md
+++ b/docs/local.md
@@ -28,8 +28,8 @@ cp cmdb-api/settings.example.py cmdb-api/settings.py
   - 后端: 进入**cmdb-api**目录执行 `pipenv run flask run -h 0.0.0.0`
   - 前端: 进入**cmdb-ui**目录执行`yarn run serve`
   - worker: 
-    - 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q one_cmdb_async --concurrency=1 -D`
-    - 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q acl_async --concurrency=1 -D`
+    - 进入**cmdb-api**目录执行 `pipenv run celery -A celery_worker.celery worker -E -Q one_cmdb_async --concurrency=1 -D`
+    - 进入**cmdb-api**目录执行 `pipenv run celery -A celery_worker.celery worker -E -Q acl_async --concurrency=1 -D`
 
   - 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
     - 如果是非本机访问, 要修改**cmdb-ui/.env**里**VUE_APP_API_BASE_URL**里的 IP 地址为后端服务的 ip 地址
diff --git a/docs/local_en.md b/docs/local_en.md
index a518a9c..9526c9f 100644
--- a/docs/local_en.md
+++ b/docs/local_en.md
@@ -26,8 +26,8 @@
   - backend: in **cmdb-api** directory: `pipenv run flask run -h 0.0.0.0`
   - frontend: in **cmdb-ui** directory: `yarn run serve`
   - worker: 
-    - in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q one_cmdb_async --concurrency=1 -D`
-    - in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q acl_async --concurrency=1 -D`
+    - in **cmdb-api** directory: `pipenv run celery -A celery_worker.celery worker -E -Q one_cmdb_async --concurrency=1 -D`
+    - in **cmdb-api** directory: `pipenv run celery -A celery_worker.celery worker -E -Q acl_async --concurrency=1 -D`
 
   - homepage: [http://127.0.0.1:8000](http://127.0.0.1:8000)
     - if not run localhost: please change ip address(**VUE_APP_API_BASE_URL**) in config file **cmdb-ui/.env** into your backend ip address