diff --git a/omniadvisor/src/omniadvisor/service/spark_service/spark_run.py b/omniadvisor/src/omniadvisor/service/spark_service/spark_run.py index 403e120ebb5ce21662662b0cc78790e70ab0e811..146d1e732af026a4f78b44071c47e7fd5e5a1e5d 100644 --- a/omniadvisor/src/omniadvisor/service/spark_service/spark_run.py +++ b/omniadvisor/src/omniadvisor/service/spark_service/spark_run.py @@ -1,6 +1,6 @@ import multiprocessing import time -from requests.exceptions import HTTPError +from requests.exceptions import HTTPError, ConnectionError from common.constant import OA_CONF from omniadvisor.repository.model.load import Load @@ -116,6 +116,9 @@ def _update_trace_from_history_server(exam_record: ExamRecord, application_id: s time.sleep(OA_CONF.spark_fetch_trace_interval) global_logger.debug(f"Cannot access history server: %s", httpe) continue + except ConnectionError: + # raise from None是为了屏蔽前序异常的堆栈信息 + raise RuntimeError('Connection is refused when fetching trace, please check spark history server.') from None trace_dict['sql'] = save_trace_data(data=trace_sql, data_dir=OA_CONF.data_dir) trace_dict['stages'] = save_trace_data(data=trace_stages, data_dir=OA_CONF.data_dir) trace_dict['executor'] = save_trace_data(data=trace_executor, data_dir=OA_CONF.data_dir)