diff --git a/python/pipeline/dag.py b/python/pipeline/dag.py index 138a2bac132dd3e8afc8209554efb7da02e32853..1275bc704884f6d497da446d03914e24f62fd8ea 100644 --- a/python/pipeline/dag.py +++ b/python/pipeline/dag.py @@ -29,8 +29,9 @@ import json from .error_catch import ErrorCatch, CustomException, CustomExceptionCode, ParamChecker, ParamVerify from .operator import Op, RequestOp, ResponseOp, VirtualOp from .channel import (ThreadChannel, ProcessChannel, ChannelData, - ChannelDataErrcode, ChannelDataType, ChannelStopError, - ProductErrCode) + ChannelDataType, ChannelStopError) +from .error_catch import ProductErrCode +from .error_catch import CustomExceptionCode as ChannelDataErrcode from .profiler import TimeProfiler, PerformanceTracer from .util import NameGenerator, ThreadIdGenerator, PipelineProcSyncManager from .proto import pipeline_service_pb2 diff --git a/python/pipeline/error_catch.py b/python/pipeline/error_catch.py index 0749134ebfda52712e13473ab4f5d16005ba81eb..d56db57bc0b7f4c454266f7a1102a528fdffb081 100644 --- a/python/pipeline/error_catch.py +++ b/python/pipeline/error_catch.py @@ -48,8 +48,9 @@ class CustomExceptionCode(enum.Enum): class ProductErrCode(enum.Enum): """ - ProductErrCode is a base class for recording business error code. - product developers overwrites this class and extend more error codes. + ProductErrCode is to record business error codes. + the ProductErrCode number ranges from 51 to 99 + product developers can directly add error code into this class. """ pass @@ -105,13 +106,13 @@ class ErrorCatch(): _LOGGER.error("\nLog_id: {}\n{}Classname: {}\nFunctionName: {}\nArgs: {}".format(log_id, traceback.format_exc(), func.__qualname__, func.__name__, args)) split_list = re.split("\n|\t|:", str(e)) resp.err_no = int(split_list[3]) - resp.err_msg = "Log_id: {} ErrNo: {} Error_msg: {} ClassName: {} FunctionName: {}".format(log_id, resp.err_no, split_list[9], func.__qualname__ ,func.__name__ ) + resp.err_msg = "Log_id: {} Raise_msg: {} ClassName: {} FunctionName: {}".format(log_id, split_list[9], func.__qualname__ ,func.__name__ ) is_send_to_user = split_list[-1].replace(" ", "") if is_send_to_user == "True": return (None, resp) else: print("Erro_Num: {} {}".format(resp.err_no, resp.err_msg)) - print("Init error occurs. For detailed information, Please look up log by log_id.") + print("Init error occurs. For detailed information. Please look up pipeline.log.wf in PipelineServingLogs by log_id.") kill_stop_process_by_pid("kill", os.getpgid(os.getpid())) except Exception as e: if "log_id" in kw.keys(): @@ -123,7 +124,7 @@ class ErrorCatch(): resp = pipeline_service_pb2.Response() _LOGGER.error("\nLog_id: {}\n{}Classname: {}\nFunctionName: {}\nArgs: {}".format(log_id, traceback.format_exc(), func.__qualname__, func.__name__, args)) resp.err_no = CustomExceptionCode.UNKNOW.value - resp.err_msg = "Log_id: {} ErrNo: {} Error_msg: {} ClassName: {} FunctionName: {}".format(log_id, resp.err_no, str(e).replace("\'", ""), func.__qualname__ ,func.__name__ ) + resp.err_msg = "Log_id: {} Raise_msg: {} ClassName: {} FunctionName: {}".format(log_id, str(e).replace("\'", ""), func.__qualname__ ,func.__name__ ) return (None, resp) else: resp = pipeline_service_pb2.Response() diff --git a/python/pipeline/operator.py b/python/pipeline/operator.py index 1950d4c9689711c8be39d9164b5484e54d59b97e..4121e290565ed1a492cdf553de1e66a361fe911a 100644 --- a/python/pipeline/operator.py +++ b/python/pipeline/operator.py @@ -36,9 +36,10 @@ else: from .error_catch import ErrorCatch, CustomException, CustomExceptionCode from .proto import pipeline_service_pb2 -from .channel import (ThreadChannel, ProcessChannel, ChannelDataErrcode, - ChannelData, ChannelDataType, ChannelStopError, - ChannelTimeoutError, ProductErrCode) +from .channel import (ThreadChannel, ProcessChannel,ChannelData, + ChannelDataType, ChannelStopError, ChannelTimeoutError) +from .error_catch import ProductErrCode +from .error_catch import CustomExceptionCode as ChannelDataErrcode from .util import NameGenerator from .profiler import UnsafeTimeProfiler as TimeProfiler from . import local_service_handler