Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨优化zip包解压 #606

Merged
merged 4 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/node/servertask/looprunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def run(self):
kill_task_id = task_params['task_id']
# kill task时进程如果已不存在,会报异常: ProcessLookupError: [Errno 3] No such process
self._terminate_task(kill_task_id)
# 等待一段时间后再接下一个任务
time.sleep(self._get_task_interval)
continue

# 获取到分析任务,向server发送确认信息(kill_task不需要确认)
Expand Down Expand Up @@ -229,6 +231,8 @@ def run(self):
task = Task(task_id, task_name, request_file, response_file, task_log, env=self._origin_os_env)
task.start()
self._running_task.append(task)
# 等待一段时间后再接下一个任务
time.sleep(self._get_task_interval)
except:
# 遇到异常,输出异常信息
LogPrinter.exception("task loop encounter error.")
Expand Down
7 changes: 5 additions & 2 deletions client/node/toolloader/httploadtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from util.logutil import LogPrinter
from util.api.fileserver import RetryFileServer
from util.exceptions import FileServerError
from util.ziplib import ZipMgr
from util.pathlib import PathMgr
from util.zipmgr import Zip


class HttpToolLoader(object):
Expand All @@ -37,8 +38,10 @@ def download_tool(tool_url, dest_dir):

if os.path.exists(dest_zip_file_path):
LogPrinter.debug(f"download {tool_url} to {dest_zip_file_path}")
ZipMgr.depress(dest_zip_file_path, tool_root_dir)
# 使用7z解压
Zip().decompress_by_7z(dest_zip_file_path, tool_root_dir)
LogPrinter.debug(f"unzip {dest_zip_file_path} to {dest_dir}")
PathMgr().safe_rmpath(dest_zip_file_path)
else:
raise FileServerError(f"download {tool_url} failed!")

Expand Down
2 changes: 1 addition & 1 deletion client/settings/edition.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ class Edition(Enum):
# 版本号
# ========================
# puppy版本号,格式:浮点数,整数部分为8位日期,小数部分为编号(从1开始)
VERSION = 20220718.1
VERSION = 20220907.1