Compare commits
20 Commits
09d63b6630
...
main
Author | SHA1 | Date | |
---|---|---|---|
987ac44575 | |||
e8159fc8cb | |||
cc1463b166 | |||
14c72fe080 | |||
2922806e9c | |||
06e5111309 | |||
b04b9e9205 | |||
cad7792fa1 | |||
fd553b3442 | |||
9b849897e2 | |||
05f461f8c1 | |||
1cee89cd0a | |||
203138947b | |||
3d2e0e33af | |||
e11dc60438 | |||
7123fa1147 | |||
f1fd1aaff5 | |||
2dec392e50 | |||
6cb768a05e | |||
a0f8f49b27 |
@ -12,6 +12,6 @@ done < /opt/logs/docker_status.log
|
||||
|
||||
if [[ -s /tmp/docker_alarm.log ]]; then
|
||||
alarm=`cat /tmp/docker_alarm.log`
|
||||
python3 /opt/scripts/alert/sendmail.py "Docker Alarms" "$alarm"
|
||||
python3 /opt/git/scripts/alert/sendmail.py "Docker Alarms" "$alarm"
|
||||
fi
|
||||
|
||||
|
@ -1,325 +0,0 @@
|
||||
# coding: utf-8
|
||||
import os
|
||||
import sys
|
||||
import openpyxl
|
||||
import time
|
||||
from threading import Thread
|
||||
import pandas
|
||||
|
||||
|
||||
def traversal_files(path):
|
||||
# 功能:以列表的形式分别返回指定路径下的文件和文件夹,不包含子目录
|
||||
# 参数:路径
|
||||
# 返回值:路径下的文件夹列表 路径下的文件列表
|
||||
if not os.path.exists(path):
|
||||
msg = f'数据文件夹{path}不存在,请确认后重试......'
|
||||
warn_pause_exit(msg, 1, 11)
|
||||
else:
|
||||
dirs = []
|
||||
files = []
|
||||
for item in os.scandir(path):
|
||||
if item.is_dir():
|
||||
dirs.append(item.path)
|
||||
elif item.is_file():
|
||||
files.append(item.path)
|
||||
|
||||
return dirs, files
|
||||
|
||||
|
||||
def get_threshold_step(excel_file, AXIS):
|
||||
# 功能:负载和速度100%,且是j2的时候,做特殊处理
|
||||
# 参数:新生成的excel,轴号
|
||||
# 返回值:速度差阈值,处理步长
|
||||
conditions = sorted(excel_file.split('\\')[-2].split('_'))
|
||||
# 只有负载和速度是100%时,才会启用更敏感的step
|
||||
flg = 1 if conditions[0][-3:] == '100' and conditions[2][-3:] == '100' else 0
|
||||
if flg == 1 and AXIS == 'j2':
|
||||
threshold = 30
|
||||
step = 5
|
||||
else:
|
||||
threshold = 10
|
||||
step = 5
|
||||
|
||||
return threshold, step
|
||||
|
||||
|
||||
def find_row_start(excel_file, ws_data, conditions, AV, RR, AXIS):
|
||||
# 功能:查找数据文件中有效数据的行号,也即最后一个速度下降的点位
|
||||
# 参数:如上
|
||||
# 返回值:速度下降点位,最后的数据点位
|
||||
ratio = float(conditions[1].removeprefix('speed'))/100
|
||||
speed_max = AV * ratio * RR / 6
|
||||
row_max = row_start = ws_data.max_row
|
||||
|
||||
threshold, step = get_threshold_step(excel_file, AXIS)
|
||||
while row_start > step+1:
|
||||
speed = ws_data[f"A{row_start}"].value
|
||||
if speed is None or int(speed) < 1:
|
||||
row_start -= 50
|
||||
continue
|
||||
_ = []
|
||||
for i in range(row_start, row_start-step+1, -1):
|
||||
_.append(ws_data[f"A{i}"].value)
|
||||
speed_avg = abs(sum(_))/len(_)
|
||||
if abs(speed_avg-speed_max) < threshold:
|
||||
row_start = row_start - 10
|
||||
break
|
||||
else:
|
||||
row_start -= step
|
||||
else:
|
||||
os.remove(excel_file)
|
||||
msg = f"可能是{excel_file.replace('xlsx', 'data')},这个文件数据采集有问题,比如采集的时机不对,也有可能是程序步长设定问题,请检查......"
|
||||
warn_pause_exit(msg, 1, 9)
|
||||
|
||||
return row_max, row_start
|
||||
|
||||
|
||||
def find_result_sheet_name(conditions, count):
|
||||
# 功能:获取结果文件准确的sheet页名称
|
||||
# 参数:臂展和速度的列表
|
||||
# 返回值:结果文件对应的sheet name
|
||||
# 33%臂展_33%速度_正1
|
||||
reach = conditions[0].removeprefix('reach')
|
||||
speed = conditions[1].removeprefix('speed')
|
||||
result_sheet_name = f"{reach}%臂展_{speed}%速度_正{count}"
|
||||
|
||||
return result_sheet_name
|
||||
|
||||
|
||||
def copy_data_to_result(ws_data, ws_result, row_max, row_start):
|
||||
# 功能:将数据文件中有效数据拷贝至结果文件对应的 sheet
|
||||
# 参数:如上
|
||||
# 返回值:-
|
||||
# 结果文件数据清零
|
||||
for row in ws_result.iter_rows(min_row=2, min_col=1, max_row=2000, max_col=2):
|
||||
for cell in row:
|
||||
cell.value = None
|
||||
|
||||
# 将合适的数据复制到结果文件
|
||||
row_max = row_start + 399 if row_max-row_start > 400 else row_max
|
||||
|
||||
data = []
|
||||
for row in ws_data.iter_rows(min_row=row_start, min_col=1, max_row=row_max, max_col=2):
|
||||
for cell in row:
|
||||
data.append(cell.value)
|
||||
i = 0
|
||||
for row in ws_result.iter_rows(min_row=2, min_col=1, max_row=row_max - row_start + 2, max_col=2):
|
||||
for cell in row:
|
||||
cell.value = data[i]
|
||||
i = i + 1
|
||||
|
||||
|
||||
def single_file_process(data_file, wb_result, count, AV, RR, RC, AXIS):
|
||||
# 功能:完成单个数据文件的处理
|
||||
# 参数:如上
|
||||
# 返回值:-
|
||||
excel_file = data_file.replace('.data', '.xlsx')
|
||||
sheet_name = data_file.split('\\')[-1].removesuffix('.data')
|
||||
df = pandas.read_csv(data_file, sep='\t')
|
||||
df.to_excel(excel_file, sheet_name=sheet_name, index=False)
|
||||
|
||||
conditions = sorted(data_file.split('\\')[-2].split('_')[1:])
|
||||
result_sheet_name = find_result_sheet_name(conditions, count)
|
||||
ws_result = wb_result[result_sheet_name]
|
||||
|
||||
wb_data = openpyxl.load_workbook(excel_file)
|
||||
ws_data = wb_data[sheet_name]
|
||||
row_max, row_start = find_row_start(excel_file, ws_data, conditions, AV, RR, AXIS)
|
||||
|
||||
copy_data_to_result(ws_data, ws_result, row_max, row_start)
|
||||
ws_result["C2"] = int(2)
|
||||
ws_result["G2"] = int(10+4)
|
||||
|
||||
wb_data.save(excel_file)
|
||||
wb_data.close()
|
||||
|
||||
|
||||
def now_doing_msg(docs, flag):
|
||||
# 功能:输出正在处理的文件或目录
|
||||
# 参数:文件或目录,start 或 done 标识
|
||||
# 返回值:-
|
||||
now = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
|
||||
file_type = 'file' if os.path.isfile(docs) else 'dir'
|
||||
if flag == 'start' and file_type == 'dir':
|
||||
print(f"[{now}] 正在处理目录【{docs}】中的数据......")
|
||||
elif flag == 'start' and file_type == 'file':
|
||||
print(f"[{now}] 正在处理文件【{docs}】中的数据......")
|
||||
elif flag == 'done' and file_type == 'dir':
|
||||
print(f"[{now}] 目录【{docs}】数据文件已处理完毕......")
|
||||
elif flag == 'done' and file_type == 'file':
|
||||
print(f"[{now}] 文件【{docs}】数据文件已处理完毕......")
|
||||
|
||||
|
||||
def data_process(result_file, raw_data_dirs, AV, RR, RC, AXIS):
|
||||
# 功能:完成一个结果文件的数据处理
|
||||
# 参数:结果文件,数据目录,以及预读取的参数
|
||||
# 返回值:-
|
||||
prefix = result_file.split('\\')[-1].split('_')[0]
|
||||
wb_result = openpyxl.load_workbook(result_file) # 打开和关闭结果文件夹十分耗时间
|
||||
for raw_data_dir in raw_data_dirs:
|
||||
if raw_data_dir.split('\\')[-1].split('_')[0] == prefix:
|
||||
now_doing_msg(raw_data_dir, 'start')
|
||||
_, data_files = traversal_files(raw_data_dir)
|
||||
# 数据文件串行处理模式---------------------------------
|
||||
# count = 1
|
||||
# for data_file in data_files:
|
||||
# now_doing_msg(data_file, 'start')
|
||||
# single_file_process(data_file, wb_result, count, AV, RR, RC, AXIS)
|
||||
# count += 1
|
||||
# now_doing_msg(data_file, 'done')
|
||||
# ---------------------------------------------------
|
||||
# 数据文件并行处理模式---------------------------------
|
||||
threads = [Thread(target=single_file_process, args=(data_files[0], wb_result, 1, AV, RR, RC, AXIS)),
|
||||
Thread(target=single_file_process, args=(data_files[1], wb_result, 2, AV, RR, RC, AXIS)),
|
||||
Thread(target=single_file_process, args=(data_files[2], wb_result, 3, AV, RR, RC, AXIS))]
|
||||
[t.start() for t in threads]
|
||||
[t.join() for t in threads]
|
||||
now_doing_msg(raw_data_dir, 'done')
|
||||
# ---------------------------------------------------
|
||||
|
||||
now_doing_msg(result_file, 'done')
|
||||
print(f"保存文件需要1-2min,请耐心等待......")
|
||||
wb_result.save(result_file)
|
||||
wb_result.close()
|
||||
|
||||
|
||||
def warn_pause_exit(msg, pause_num, exit_num):
|
||||
# 功能:打印告警信息,并推出程序
|
||||
# 参数:告警信息,暂停的次数,退出的值
|
||||
# 返回值:-
|
||||
print(msg + '\n')
|
||||
for i in range(pause_num):
|
||||
_ = input("Press ENTER to continue......\n")
|
||||
sys.exit(exit_num)
|
||||
|
||||
|
||||
def check_files(raw_data_dirs, result_files):
|
||||
# 功能:检查数据文件以及结果文件的合规性
|
||||
# 参数:数据文件夹,结果文件
|
||||
# 返回值:-
|
||||
if len(result_files) != 3:
|
||||
msg = "结果文件数目错误,结果文件有且只有三个,请确认!"
|
||||
for result_file in result_files:
|
||||
print(result_file)
|
||||
warn_pause_exit(msg, 1, 3)
|
||||
|
||||
prefix = []
|
||||
for result_file in result_files:
|
||||
prefix.append(result_file.split('\\')[-1].split('_')[0])
|
||||
if not sorted(prefix) == sorted(['load33', 'load66', 'load100']):
|
||||
wd = result_files[0].split('\\')
|
||||
del wd[-1]
|
||||
wd = '\\'.join(wd)
|
||||
msg = f"请关闭所有相关数据文件,并检查工作目录【{wd}】下,有且只允许有类似如下三个文件:\n" \
|
||||
f"1. load33_自研_制动性能测试.xlsx\n" \
|
||||
f"2. load66_自研_制动性能测试.xlsx\n" \
|
||||
f"3. load100_自研_制动性能测试.xlsx"
|
||||
warn_pause_exit(msg, 1, 8)
|
||||
|
||||
for raw_data_dir in raw_data_dirs:
|
||||
components = raw_data_dir.split('\\')[-1].split('_')
|
||||
sorted(components)
|
||||
if components[0] not in ['load33', 'load66', 'load100'] or \
|
||||
components[1] not in ['speed33', 'speed66', 'speed100'] or \
|
||||
components[2] not in ['reach33', 'reach66', 'reach100']:
|
||||
msg = f"报错信息:数据目录【{raw_data_dir}】命名不合规,请参考如下形式\n" \
|
||||
f"命名规则:\n 1. loadAA_speedBB_reachCC\n 2. loadAA_reachBB_speedCC\n" \
|
||||
f"规则解释:AA/BB/CC 指的是负载/速度/臂展的比例\n" \
|
||||
f"load66_speed100_reach33:66% 负载,100% 速度以及 33% 臂展情况下的测试结果文件夹"
|
||||
warn_pause_exit(msg, 1, 7)
|
||||
|
||||
# 直接删掉 excel 文件
|
||||
_, raw_data_files = traversal_files(raw_data_dir)
|
||||
for raw_data_file in raw_data_files:
|
||||
if raw_data_file.endswith(".xlsx"):
|
||||
os.remove(raw_data_file)
|
||||
|
||||
_, raw_data_files = traversal_files(raw_data_dir)
|
||||
if len(raw_data_files) != 3:
|
||||
msg = f"数据目录【{raw_data_dir}】下数据文件个数错误,每个数据目录下有且只能有三个以 .data 为后缀的数据文件"
|
||||
warn_pause_exit(msg, 1, 6)
|
||||
for raw_data_file in raw_data_files:
|
||||
if not raw_data_file.split('\\')[-1].endswith('.data'):
|
||||
msg = f"数据文件【{raw_data_file}】后缀错误,每个数据目录下有且只能有三个以 .data 为后缀的数据文件"
|
||||
warn_pause_exit(msg, 1, 5)
|
||||
|
||||
print("数据目录合规性检查结束,未发现问题......")
|
||||
|
||||
|
||||
def delete_excel_files(raw_data_dirs):
|
||||
# 功能:删除数据文件夹里的 .xlsx 文件
|
||||
# 参数:数据文件夹
|
||||
# 返回值:-
|
||||
for raw_data_dir in raw_data_dirs:
|
||||
_, raw_data_files = traversal_files(raw_data_dir)
|
||||
for raw_data_file in raw_data_files:
|
||||
if raw_data_file.endswith('.xlsx'):
|
||||
os.remove(raw_data_file)
|
||||
|
||||
|
||||
def initialization():
|
||||
# 功能:初始化,记录开始时间,读取预定义参数
|
||||
# 参数:-
|
||||
# 返回值:结果文件,数据文件夹,以及预定义参数
|
||||
time_start = time.time() # 记录开始时间
|
||||
try:
|
||||
# read init configurations from config file
|
||||
wb_conf = openpyxl.load_workbook('./configs.xlsx', read_only=True)
|
||||
ws_conf = wb_conf['brake']
|
||||
|
||||
DATA_DIR = ws_conf.cell(row=2, column=2).value
|
||||
AV = int(ws_conf.cell(row=3, column=2).value)
|
||||
RR = int(ws_conf.cell(row=4, column=2).value)
|
||||
RC = float(ws_conf.cell(row=5, column=2).value)
|
||||
AXIS = ws_conf.cell(row=6, column=2).value
|
||||
wb_conf.close()
|
||||
except Exception as Err:
|
||||
msg = "无法在当前路径下找到或打开【configs.xlsx】文件,请确认!"
|
||||
warn_pause_exit(msg, 1, 2)
|
||||
|
||||
raw_data_dirs, result_files = traversal_files(DATA_DIR)
|
||||
delete_excel_files(raw_data_dirs)
|
||||
check_files(raw_data_dirs, result_files)
|
||||
|
||||
return raw_data_dirs, result_files, time_start, AV, RR, RC, AXIS
|
||||
|
||||
|
||||
def execution(args):
|
||||
# 功能:执行处理所有数据文件
|
||||
# 参数:initialization函数的返回值
|
||||
# 返回值:-
|
||||
raw_data_dirs, result_files, time_start, AV, RR, RC, AXIS = args
|
||||
prefix = []
|
||||
for raw_data_dir in raw_data_dirs:
|
||||
prefix.append(raw_data_dir.split('\\')[-1].split("_")[0])
|
||||
|
||||
try:
|
||||
# threads = []
|
||||
for result_file in result_files:
|
||||
if result_file.split('\\')[-1].split('_')[0] not in set(prefix):
|
||||
continue
|
||||
else:
|
||||
now_doing_msg(result_file, 'start')
|
||||
data_process(result_file, raw_data_dirs, AV, RR, RC, AXIS)
|
||||
# threads.append(Thread(target=data_process, args=(result_file, raw_data_dirs, AV, RR, RC, AXIS)))
|
||||
# [t.start() for t in threads]
|
||||
# [t.join() for t in threads]
|
||||
print("#---------------------------------------------------------")
|
||||
print("全部处理完毕")
|
||||
delete_excel_files(raw_data_dirs)
|
||||
except Exception as Err:
|
||||
print("程序运行错误,请检查配置文件是否准确设定,以及数据文件组织是否正确!")
|
||||
delete_excel_files(raw_data_dirs) # 运行结束之后,删除中间临时文件
|
||||
|
||||
time_end = time.time() # 记录结束时间
|
||||
time_total = time_end - time_start # 计算的时间差为程序的执行时间,单位为秒/s
|
||||
msg = f"数据处理时间:{time_total//3600:02} h {time_total % 3600/60:05.2f} min"
|
||||
warn_pause_exit(msg, 1, 0)
|
||||
|
||||
|
||||
def main():
|
||||
execution(initialization())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Binary file not shown.
@ -1,43 +0,0 @@
|
||||
# UTF-8
|
||||
#
|
||||
# For more details about fixed file info 'ffi' see:
|
||||
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
|
||||
VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||
# Set not needed items to zero 0.
|
||||
filevers=(0, 0, 5, 0),
|
||||
prodvers=(0, 0, 5, 0),
|
||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||
mask=0x3f,
|
||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||
flags=0x0,
|
||||
# The operating system for which this file was designed.
|
||||
# 0x4 - NT and there is no need to change it.
|
||||
OS=0x4,
|
||||
# The general type of file.
|
||||
# 0x1 - the file is an application.
|
||||
fileType=0x1,
|
||||
# The function of the file.
|
||||
# 0x0 - the function is not defined for this fileType
|
||||
subtype=0x0,
|
||||
# Creation date and time stamp.
|
||||
date=(0, 0)
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo(
|
||||
[
|
||||
StringTable(
|
||||
'040904b0',
|
||||
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
||||
StringStruct('FileDescription', 'All in one automatic operating tool'),
|
||||
StringStruct('FileVersion', '0.0.5 (2024-05-20)'),
|
||||
StringStruct('InternalName', 'AIO.exe'),
|
||||
StringStruct('LegalCopyright', '© 2024-2024 Manford Fan'),
|
||||
StringStruct('OriginalFilename', 'AIO.exe'),
|
||||
StringStruct('ProductName', 'AIO'),
|
||||
StringStruct('ProductVersion', '0.0.5 (2024-05-20)')])
|
||||
]),
|
||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||
]
|
||||
)
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
@ -1,107 +0,0 @@
|
||||
程序功能:自动化处理制动性能采集的数据,减少人工处理时长,目前测试单轴可从原来的4-6h,减少到15min
|
||||
使用方法:修改 configs.xlsx 配置文件中的一些参数(数据文件路径/减速比/最大角速度/额定电流),然后直接执行即可
|
||||
第三方库:pandas/pywin32/openpyxl
|
||||
pip3 install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
pip3 install openpyxl -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
pip3 install pywin32 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
pip3 install Pillow -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
python.exe -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
pip3 install --upgrade --force-reinstall numpy -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
打包方法:pyinstaller.exe -F --version-file file_version_info.txt -i .\icon.ico .\aio.py
|
||||
最好不用虚拟环境
|
||||
|
||||
注意事项:
|
||||
1. 数据文件存储存储规则
|
||||
所谓数据文件,就是我们拍急停的时候,采集到的 .data 文件,正方向拍三次急停,会采集到三个 .data 文件,存储在同一个文件夹内,即每组(三个 .data 文件)文件必须存储在同一个文件夹内,数据文件的命名无要求,
|
||||
|
||||
2. 文件夹命名规则
|
||||
虽然对采集到的 .data 文件没有命名要求,但是对于文件夹的命名是有要求的,必须是如下格式:
|
||||
loadXX_speedXX_reachXX 或者 loadXX_reachXX_speedXX
|
||||
这里的XX代表不同条件下的测试数值,比如:
|
||||
load100_speed33_reach66,指的是,负载100%,速度33%,臂展66%
|
||||
|
||||
3. 结果文件命名规则
|
||||
所谓结果文件,就是处理数据的那个 excle 文件,该文件名字的前缀必须是 loadXX_XXXXXXXXX.xlsx,比如:
|
||||
load33_自研_制动性能测试.xlsx
|
||||
load66_自研_制动性能测试.xlsx
|
||||
load100_自研_制动性能测试.xlsx
|
||||
|
||||
!!结果文件可以是没有数据的,也可以是之前有数据的,只要保证第 6 点中的那几个数据准确即可
|
||||
|
||||
4. 数据存储的组织结
|
||||
..../j1/load100_speed33_reach100
|
||||
..../j1/load100_speed66_reach100
|
||||
....
|
||||
..../j1/load100_speed100_reach100
|
||||
..../j1/load100_speed33_reach100/2024_05_16_09_18_52.data
|
||||
..../j1/load100_speed33_reach100/2024_05_16_09_19_52.data
|
||||
..../j1/load100_speed33_reach100/2024_05_16_09_20_52.data
|
||||
|
||||
..../j1/load33_自研_制动性能测试.xlsx
|
||||
..../j1/load66_自研_制动性能测试.xlsx
|
||||
..../j1/load100_自研_制动性能测试.xlsx
|
||||
|
||||
5. 文件的打开与关闭
|
||||
a. 在执行程序之前,需要关闭所有相关 excle 文件
|
||||
b. 在执行程序之中,不允许打开相关 excle 文件
|
||||
c. 在执行程序之后,需要逐个打开结果文件,并保存一次
|
||||
|
||||
6. 参数一致性检查
|
||||
执行程序前,需要确定 configs.xlsx 中设定的减速比/最大角速度/额定电流的值是正确的
|
||||
|
||||
7. 数据准确性检查
|
||||
执行完程序之后,需要对结果文件的数据准确性做核对,通过我自己的数据观察,误差基本在10ms以内,也即10个数据点,误差较大的情况可自行调整
|
||||
|
||||
8. .data 数据顺序
|
||||
.data 文件的第一列和第二列必须分别是速度和电流
|
||||
|
||||
9. 其他
|
||||
程序运行主要的耗时集中在打开,保存和关闭结果文件,第一次打开的时候会比较慢,是因为 excel 在做首次公式的计算,保存关闭之后,再打开会比较快一些,另外,如果在运行出错并重复运行程序的时候无响应,或者出现异常,请打开任务管理器,关闭一切和excel相关的进程,重新运行即可
|
||||
|
||||
|
||||
|
||||
RELEASE CHANGES
|
||||
|
||||
|
||||
已知问题:
|
||||
1. office套件下运行好像有问题,WPS无问题,集中在just_open函数的实现上
|
||||
|
||||
v0.0.1(2024/05/18)
|
||||
Draft
|
||||
|
||||
v0.0.2(2024/05/20)
|
||||
1. 功能模块化,为后面其他功能奠定一个基本的框架
|
||||
2. 使用了多线程提高效率
|
||||
3. 优化了准备工作中的细节
|
||||
4. 运行初始化时自动删除 raw_data_dir 中的 .xlsx 文件
|
||||
5. 优化了输出格式
|
||||
6. 使用 pyinstaller 库进行代码冻结并调试成功
|
||||
|
||||
v0.0.3(2024/05/21)
|
||||
1. just_open函数打开失败的信息中,添加文件名
|
||||
2. 删除global变量,函数全部通过传参实现
|
||||
3. configuration.xlsx配置文件增加AXIS常量,表示那个轴,取值为 j1/j2/j3/j4/j5/j6/j7
|
||||
4. [bugfix] 增加get_threshold_step函数,用来获取在计算row_start时合适的阈值和步长,主要是解决了二轴最差工况下,最大速度是个尖端的问题:
|
||||
a. load100_speed100_reachxxx 二轴 threshold = 50 step = 20
|
||||
b. 其他 threshold = 50 step = 100
|
||||
如上是一个比较保守的设定,因为设定的step比较小,找到点之后要往后延200最好
|
||||
5. 在find_row_start_dp函数中新增一个参数data_file,方便后续调试
|
||||
|
||||
v0.0.4(2024/05/22)
|
||||
1. 重新标定了get_threshold_step函数,让处理更加准确
|
||||
2. 新定义了now_doing_msg函数,实时输出处理信息
|
||||
3. 修改了find_row_start和find_row_start_dp函数,增加的部分相同,处理数据的时候,先判断是否是空值,或者是0,此时可以加快步进
|
||||
4. 修改了just_open函数,不在做重试
|
||||
|
||||
v0.0.5(2024/05/23)
|
||||
1. 完善了函数注释
|
||||
2. 调整了阈值和步长
|
||||
3. 删除了just_open函数,以及对应的win32com库(Thank GOD!终于可以不用这个库了)
|
||||
4. 重写了获取开始点位的代码,直接使用speed来判断,而不用角度,所以find_row_start_dp以及copy_data_to_excel_file函数也被一并删除
|
||||
|
||||
|
||||
v0.x.x(2024/05/xx)
|
||||
1. 修改configuration.xlsx变量顺序,同步调整代码,为了调整多功能框架,aio.py文件将会作为入口程序存在,不实现具体功能
|
||||
2. 功能的实现将由具体的功能脚本实现,aio.py只负责条件调用
|
||||
3. 使用pytinstaller打包多文件为exe可执行程序
|
||||
4. 新增了自动化处理电机电流数据的功能
|
@ -26,7 +26,7 @@ cp -rf /lib/firmware/intel/ ibt-0040-1050* /opt/configs/conf/intel/
|
||||
|
||||
cd /opt && t=`date +%Y%m%dT%H%M%S`
|
||||
# rsync --delete-after -avz --exclude=apps/localcr/B_koel/local/music apps configs logs scripts websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log
|
||||
rsync --delete-after -avz apps configs logs scripts websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log
|
||||
rsync --delete-after -avz --exclude=apps/syncthing apps configs logs git websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log
|
||||
cd /opt/logs/rsync/
|
||||
let count=`ls | wc -l`
|
||||
if [[ $count -gt 10 ]]; then
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#==============================================================================
|
||||
/usr/bin/qbittorrent-nox --webui-port=10005 -d
|
||||
# /usr/bin/bash /opt/scripts/update/calibre.sh
|
||||
mv /opt/wd/99-Temp/shutdown /opt/wd/99-Temp/shutdown.old
|
||||
mv /opt/wd/99-Temp/reboot /opt/wd/99-Temp/reboot.old
|
||||
sleep 20
|
||||
@ -13,7 +12,7 @@ ifconfig > /opt/wd/99-Temp/ifconfig.txt
|
||||
# ip link set wlx90de80ca01ec promisc on
|
||||
#==============================================================================
|
||||
# sleep 20
|
||||
# /usr/bin/bash /opt/scripts/update/macvlan.sh
|
||||
# /usr/bin/bash /opt/git/scripts/update/macvlan.sh
|
||||
#==============================================================================
|
||||
# /usr/bin/mount -t ext4 -w UUID="b7c2c4b8-bfde-479b-80bb-655432a433b8" /opt/wd
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get latest hosts for accelerate github visiting
|
||||
curl https://raw.hellogithub.com/hosts >> /opt/logs/hosts
|
||||
# curl https://raw.hellogithub.com/hosts >> /opt/logs/hosts
|
||||
|
||||
# renew images.json file for background picture of homepage
|
||||
cd /opt/websites/homepage/
|
||||
@ -9,7 +9,7 @@ node assets/js/bing.js > /dev/null 2>&1
|
||||
|
||||
if [[ `date +%d` == '01' ]]; then
|
||||
# random logo for dash
|
||||
# bash /opt/scripts/update/dash_rand_logo.sh
|
||||
# bash /opt/git/scripts/update/dash_rand_logo.sh
|
||||
cp /root/.acme/rustle.cc_ecc/fullchain.cer '/opt/apps/syncthing/data/common/A_Program/nginx-1.24.0/certs/'
|
||||
cp /root/.acme/rustle.cc_ecc/rustle.cc.key '/opt/apps/syncthing/data/common/A_Program/nginx-1.24.0/certs/'
|
||||
fi
|
||||
@ -19,4 +19,4 @@ let numOfAvatar=`ls /opt/websites/homepage/assets/img/logos | wc -l`
|
||||
let randNumber=$RANDOM%$numOfAvatar
|
||||
cp /opt/websites/homepage/assets/img/logos/${randNumber}.jpg /opt/websites/homepage/assets/img/logo.jpg
|
||||
|
||||
docker exec -u www-data nextcloud php /var/www/html/occ files:scan --all
|
||||
# docker exec -u www-data nextcloud php /var/www/html/occ files:scan --all
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
rss=$(ps aux | grep frpc.toml | grep -v grep | awk '{print $6}')
|
||||
if [[ $rss == '' ]]; then
|
||||
python3 /opt/scripts/alert/bark/msgsend.py --title "FRPC Warning" --body "Seems like FRPC Service has been down, need to check ASAP." --group 'frp' --icon 8
|
||||
python3 /opt/git/scripts/alert/bark/msgsend.py --title "FRPC Warning" --body "Seems like FRPC Service has been down, need to check ASAP." --group 'frp' --icon 8
|
||||
exit 9
|
||||
fi
|
||||
|
||||
|
@ -24,7 +24,7 @@ def utool(option):
|
||||
# -a
|
||||
def list_local_using_port():
|
||||
exit_on_wrong_number()
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/ipports.sh port')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/ipports.sh port')
|
||||
|
||||
# -b
|
||||
def github_two_factor():
|
||||
@ -34,7 +34,7 @@ def utool(option):
|
||||
# -c
|
||||
def get_external_ip():
|
||||
exit_on_wrong_number()
|
||||
os.system("/usr/bin/python3 /opt/scripts/roll_api/get_self_ip.py")
|
||||
os.system("/usr/bin/python3 /opt/git/scripts/roll_api/get_self_ip.py")
|
||||
|
||||
# -d
|
||||
def get_ip_location():
|
||||
@ -44,7 +44,7 @@ def utool(option):
|
||||
ipv4 = re.match(r"^((([01]?\d\d?)|(2[0-4]\d)|(25[0-5]))\.){3}(([01]?\d\d?)|(2[0-4]\d)|(25[0-5]))$", checked_ip)
|
||||
if ipv4:
|
||||
os.environ['checked_ip'] = checked_ip
|
||||
os.system('/usr/bin/python3 /opt/scripts/roll_api/get_ip.py $checked_ip')
|
||||
os.system('/usr/bin/python3 /opt/git/scripts/roll_api/get_ip.py $checked_ip')
|
||||
else:
|
||||
print(f"{c_br}Plz enter correct IP...{c_e}")
|
||||
exit(ord(option.strip('-')))
|
||||
@ -69,12 +69,12 @@ def utool(option):
|
||||
def number2date():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['param'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/number2d.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/number2d.sh $param')
|
||||
|
||||
# -g
|
||||
def date2number():
|
||||
if len(sys.argv) < 3:
|
||||
print(f"{c_br}-k选项:将输入的时间转换成十进制和十六进制,需要一个字符串格式的时间作为输入,退出...{c_e}\n")
|
||||
print(f"{c_br}-g选项:将输入的时间转换成十进制和十六进制,需要一个字符串格式的时间作为输入,退出...{c_e}\n")
|
||||
exit(ord(option.strip('-')))
|
||||
|
||||
param=''
|
||||
@ -82,7 +82,7 @@ def utool(option):
|
||||
param += item + ' '
|
||||
|
||||
os.environ['param'] = param
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/date2n.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/date2n.sh $param')
|
||||
|
||||
# -h
|
||||
def usage():
|
||||
@ -92,19 +92,32 @@ def utool(option):
|
||||
# -i
|
||||
def ps_top_20():
|
||||
exit_on_wrong_number()
|
||||
os.system("/usr/bin/bash /opt/scripts/utool/ps_top_20.sh")
|
||||
os.system("/usr/bin/bash /opt/git/scripts/utool/ps_top_20.sh")
|
||||
|
||||
# -j
|
||||
def docker_pid():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['param'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/pid_in_docker.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/pid_in_docker.sh $param')
|
||||
|
||||
# -k
|
||||
def company_two_factor():
|
||||
exit_on_wrong_number()
|
||||
# method 1
|
||||
# os.system("/usr/bin/echo -n 'ujjpsx7q'")
|
||||
# os.system("/usr/bin/oathtool -b --totp '22IH2VYKEQYOWVFCCHY5KTU4CYTJ7Z3O'")
|
||||
# method 2
|
||||
pin = 'ujjpsx7q'
|
||||
totp = os.popen("/usr/bin/oathtool -b --totp '22IH2VYKEQYOWVFCCHY5KTU4CYTJ7Z3O'").read()
|
||||
res = pin + totp
|
||||
print(res, end='')
|
||||
return res
|
||||
|
||||
# -p
|
||||
def gen_passwd():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['length'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/genpw.sh length')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/genpw.sh length')
|
||||
|
||||
def exit_on_wrong_number(number=1):
|
||||
if len(sys.argv) != (number+1):
|
||||
@ -134,7 +147,7 @@ def utool(option):
|
||||
'-v': ['Reserved', None],
|
||||
'-j': ['*find a docker subprocess, if true then print info', docker_pid],
|
||||
'-w': ['Reserved', None],
|
||||
'-k': ['Reserved', None],
|
||||
'-k': [' generate two-factor key of GITHUB', company_two_factor],
|
||||
'-x': ['Reserved', None],
|
||||
'-l': ['Reserved', None],
|
||||
'-y': ['Reserved', None],
|
||||
|
Reference in New Issue
Block a user