mdbq 3.7.4__py3-none-any.whl → 3.7.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {mdbq-3.7.4.dist-info → mdbq-3.7.5.dist-info}/METADATA +1 -1
  2. mdbq-3.7.5.dist-info/RECORD +4 -0
  3. {mdbq-3.7.4.dist-info → mdbq-3.7.5.dist-info}/WHEEL +1 -1
  4. mdbq-3.7.5.dist-info/top_level.txt +1 -0
  5. mdbq/__init__.py +0 -1
  6. mdbq/__version__.py +0 -3
  7. mdbq/aggregation/__init__.py +0 -4
  8. mdbq/aggregation/aggregation_bak.py +0 -1438
  9. mdbq/aggregation/datashow_bak.py +0 -1264
  10. mdbq/aggregation/optimize_data.py +0 -76
  11. mdbq/aggregation/query_data.py +0 -3869
  12. mdbq/bdup/__init__.py +0 -5
  13. mdbq/bdup/bdup.py +0 -111
  14. mdbq/config/__init__.py +0 -4
  15. mdbq/config/default.py +0 -131
  16. mdbq/config/myconfig.py +0 -32
  17. mdbq/config/products.py +0 -159
  18. mdbq/config/set_support.py +0 -22
  19. mdbq/dataframe/__init__.py +0 -4
  20. mdbq/dataframe/converter.py +0 -107
  21. mdbq/log/__init__.py +0 -4
  22. mdbq/log/mylogger.py +0 -66
  23. mdbq/log/spider_logging.py +0 -55
  24. mdbq/mongo/__init__.py +0 -4
  25. mdbq/mongo/mongo.py +0 -729
  26. mdbq/mysql/__init__.py +0 -4
  27. mdbq/mysql/mysql.py +0 -1784
  28. mdbq/mysql/s_query.py +0 -211
  29. mdbq/mysql/year_month_day.py +0 -38
  30. mdbq/other/__init__.py +0 -4
  31. mdbq/other/download_sku_picture.py +0 -985
  32. mdbq/other/porxy.py +0 -115
  33. mdbq/other/pov_city.py +0 -405
  34. mdbq/other/sku_picture_bak.py +0 -1081
  35. mdbq/other/ua_sj.py +0 -222
  36. mdbq/pbix/__init__.py +0 -4
  37. mdbq/pbix/pbix_refresh.py +0 -70
  38. mdbq/pbix/refresh_all.py +0 -158
  39. mdbq/pbix/refresh_all_old.py +0 -177
  40. mdbq/redis/__init__.py +0 -4
  41. mdbq/redis/getredis.py +0 -642
  42. mdbq/spider/__init__.py +0 -4
  43. mdbq/spider/aikucun.py +0 -494
  44. mdbq-3.7.4.dist-info/RECORD +0 -43
  45. mdbq-3.7.4.dist-info/top_level.txt +0 -1
@@ -1,76 +0,0 @@
1
- # -*- coding: UTF-8 –*-
2
- from mdbq.mongo import mongo
3
- from mdbq.mysql import mysql
4
- from mdbq.config import default
5
- import socket
6
- import subprocess
7
- import psutil
8
- import time
9
- import platform
10
- import logging
11
- """
12
- 对指定数据库所有冗余数据进行清理
13
- """
14
- m_engine, username, password, host, port = default.get_mysql_engine(platform='Windows', hostname='xigua_lx', sql='mysql', local='remoto', config_file=None)
15
- if not username:
16
- logger.info(f'找不到主机:')
17
-
18
- logger = logging.getLogger(__name__)
19
-
20
-
21
- def restart_mongodb():
22
- """
23
- 检查服务, 并重启, 只能操作本机
24
- """
25
-
26
- def get_pid(program_name):
27
- # macos 系统中,使用psutil.process_iter()遍历系统中所有运行的进程
28
- for process in psutil.process_iter(['name', 'pid']):
29
- if process.info['name'] == program_name:
30
- return process.info['pid']
31
- return None
32
-
33
- if platform.system() == 'Windows':
34
- logger.info(f'即将重启 mongodb 服务')
35
- time.sleep(60)
36
- stop_command = f'net stop MongoDB'
37
- subprocess.call(stop_command, shell=True) # 停止MongoDB服务
38
-
39
- time.sleep(30)
40
- start_command = f'net start MongoDB'
41
- subprocess.call(start_command, shell=True) # 启动MongoDB服务
42
- time.sleep(30)
43
-
44
- elif platform.system() == 'Darwin':
45
- logger.info(f'即将重启 mongodb 服务')
46
- time.sleep(60)
47
- result = get_pid('mongod') # 获取进程号
48
- if result: # 有 pid, 重启服务
49
- command = f'kill {result}'
50
- subprocess.call(command, shell=True)
51
- time.sleep(10)
52
- command = f'mongod --config /usr/local/mongodb/mongod.conf'
53
- subprocess.call(command, shell=True)
54
- # logger.info('已重启服务')
55
- else: # 没有启动, 则启动服务
56
- command = f'mongod --config /usr/local/mongodb/mongod.conf'
57
- subprocess.call(command, shell=True)
58
-
59
- elif platform.system() == 'Linux':
60
- logger.info(f'即将重启 mongodb 服务')
61
- time.sleep(60)
62
- command = f'service mongod restart'
63
- subprocess.call(command, shell=True)
64
-
65
-
66
- def op_data(db_name_lists, days: int = 63, is_mongo=True, is_mysql=True):
67
- # Mysql
68
- if is_mysql:
69
- s = mysql.OptimizeDatas(username=username, password=password, host=host, port=port)
70
- s.db_name_lists = db_name_lists
71
- s.days = days
72
- s.optimize_list()
73
-
74
-
75
- if __name__ == '__main__':
76
- op_data(db_name_lists=['聚合数据'], days=10, is_mongo=True, is_mysql=True)