Skip to content

Commit

Permalink
fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wayyoungboy committed Aug 19, 2024
1 parent 53dfb46 commit 8f6876f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion diag_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def do_command(self):
if ROOT_IO.silent:
if isinstance(ret, ObdiagResult) is False:
ROOT_IO.error('The return value of the command is not ObdiagResult. Please contact thebase community. The return value is: {0}'.format(ret))
ret = ObdiagResult(code=ObdiagResult.SERVER_ERROR_CODE, error_data= "The return value of the command is not ObdiagResult. Maybe the command not support silent. Please contact thebase community." )
ret = ObdiagResult(code=ObdiagResult.SERVER_ERROR_CODE, error_data="The return value of the command is not ObdiagResult. Maybe the command not support silent. Please contact thebase community.")
ret.set_trace_id(self.trace_id)

def args_to_str(args):
Expand Down
7 changes: 6 additions & 1 deletion handler/analyzer/analyze_flt_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def handle_from_node(node):
data = future.result()
tree.build(data)
# output tree
return self.__output(local_store_parent_dir, tree, self.output)
result = self.__output(local_store_parent_dir, tree, self.output)
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": local_store_parent_dir, "result": result})

def __handle_from_node(self, node, old_files, local_store_parent_dir):
resp = {"skip": False, "error": ""}
Expand Down Expand Up @@ -348,8 +349,12 @@ def __output(self, result_dir, tree, output_terminal=60):
self.stdio.print(last_info)
result_info = ""
with open(filename, 'r', encoding='utf-8') as f:
line_nu = 0
for line in f:
result_info += line
line_nu += 1
if line_nu > 60:
break
return result_info

def parse_file(self, file):
Expand Down
2 changes: 1 addition & 1 deletion handler/analyzer/analyze_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def alalyze_parameter_diff(self):
fp.close()
if not is_empty:
self.stdio.print("Analyze parameter diff finished. For more details, please run cmd '" + Fore.YELLOW + " cat {0} ".format(file_name) + Style.RESET_ALL + "'")
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"result": report_diff_tbs, "file_name": file_name})
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"result": report_diff_tbs, "store_dir": file_name})
else:
self.stdio.print("Analyze parameter diff finished. All parameter settings are consistent among observers")
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"result": "Analyze parameter diff finished. All parameter settings are consistent among observers"})
Expand Down
2 changes: 1 addition & 1 deletion handler/rca/rca_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def execute(self):
except Exception as e:
raise Exception("rca_scene.export_result err: {0}".format(e))
self.stdio.print("rca finished. For more details, the result on '" + Fore.YELLOW + self.get_result_path() + Style.RESET_ALL + "' \nYou can get the suggest by '" + Fore.YELLOW + "cat " + self.get_result_path() + "/record" + Style.RESET_ALL + "'")
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.get_result_path(), "record": self.rca_scene.records_data()})
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.get_result_path(), "record": self.rca_scene.Result.records_data()})


class RcaScene:
Expand Down
4 changes: 4 additions & 0 deletions stdio.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ def _stop_sync_obj(self, sync_clz, stop_type, *arg, **kwargs):
return ret

def start_loading(self, text, *arg, **kwargs):
if self.silent:
return True
if self.sync_obj:
return False
self.sync_obj = self._start_sync_obj(IOHalo, lambda x: x.stop_loading('fail'), *arg, **kwargs)
Expand All @@ -646,6 +648,8 @@ def start_loading(self, text, *arg, **kwargs):
return self.sync_obj.start(text)

def stop_loading(self, stop_type, *arg, **kwargs):
if self.silent:
return True
if not isinstance(self.sync_obj, IOHalo):
return False
if getattr(self.sync_obj, stop_type, False):
Expand Down
8 changes: 3 additions & 5 deletions update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ def execute(self):
)
return ObdiagResult(
ObdiagResult.SERVER_ERROR_CODE,
error_data=
"remote_obdiag_version is {0}. local_obdiag_version is {1}. "
error_data="remote_obdiag_version is {0}. local_obdiag_version is {1}. "
"remote_obdiag_version>local_obdiag_version. Unable to update dependency files, please upgrade "
"obdiag. Do not perform the upgrade process.".format(self.remote_obdiag_version, self.local_obdiag_version)
,
"obdiag. Do not perform the upgrade process.".format(self.remote_obdiag_version, self.local_obdiag_version),
)
if remote_data.get("remote_tar_sha") is None:
self.stdio.warn("remote_tar_sha is None. Do not perform the upgrade process.")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data= "remote_tar_sha is None. Do not perform the upgrade process.")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data="remote_tar_sha is None. Do not perform the upgrade process.")
else:
self.remote_tar_sha = remote_data["remote_tar_sha"]
# need update?
Expand Down

0 comments on commit 8f6876f

Please sign in to comment.