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

🎨优化api请求和进度上报 #666

Merged
merged 3 commits into from
Oct 25, 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
2 changes: 1 addition & 1 deletion client/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ USERNAME=
PASSWORD=

[LICENSE_CONFIG]
; [可选]使用自研工具时,需要填写,默认不需要
; [可选]使用自研工具时,需要填写,默认不需要(优先企业或高校申请License)
; license服务器url, base_path, license
URL=
BASE_PATH=
Expand Down
Binary file modified client/task/authcheck/check_license.cp37-win_amd64.pyd
Binary file not shown.
Binary file not shown.
Binary file modified client/task/authcheck/check_license.cpython-37m-darwin.so
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion client/util/api/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
""" http client
"""

import ssl
import json
import logging

Expand Down Expand Up @@ -40,7 +41,7 @@ def request(url, headers, param=None, body=None, method="POST"):
try:
request = Request(url=url, data=body, headers=headers)
request.get_method = lambda: method.upper()
response = urlopen(request)
response = urlopen(request, context=ssl._create_unverified_context())
return response
except HTTPError as err:
error_msg = err.read().decode('utf-8')
Expand Down
5 changes: 3 additions & 2 deletions client/util/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def update_task_progress(self, info):
token = Crypto(settings.PASSWORD_KEY).decrypt(encrypted_token)

dog_server = RetryDogServer(server_url, token).get_api_server(retry_times=0)
# 非节点模式,不存在NODE_ID字段,此时传参为None
# 非节点模式,NODE_ID字段传参为None
node_id = persist_data.get('NODE_ID') if self._task_scene == TaskScene.NORMAL else None
dog_server.update_task_progress(self._task_params,
persist_data.get('NODE_ID'),
node_id,
info.message,
info.percent)
except Exception as err:
Expand Down