Skip to content

Commit d55b3c3

Browse files
Fixed when a log decoding error caused the process to terminate. (#515)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling when retrieving logs to prevent decoding errors from causing failures. If a decoding error occurs, an empty log is returned instead of an error message. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 5f8c1a6 commit d55b3c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dpdispatcher/utils/dpcloudserver/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ def get_log(self, job_id):
278278
return ""
279279
resp = requests.get(url, headers={"Range": f"bytes={self.last_log_offset}-"})
280280
self.last_log_offset += len(resp.content)
281-
return resp.content.decode("utf-8")
281+
try:
282+
return resp.content.decode("utf-8")
283+
except Exception as e:
284+
dlog.error(f"Error decoding job log: {e}", stack_info=ENABLE_STACK)
285+
return ""
282286

283287
def _get_job_log(self, job_id):
284288
ret = self.get(

0 commit comments

Comments
 (0)