File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010# Error Constants
1111RUNTIME_APPLICATION_ERRORS_PATH = "/var/numaflow/runtime/application-errors"
12- CURRENT_FILE = "current-udf.json"
13- INTERNAL_ERROR = "Internal error"
12+ CURRENT_CRITICAL_ERROR_FILE = "current-udf.json"
13+ INTERNAL_ERROR_CODE = "Internal error"
1414CONTAINER_TYPE = os .getenv (ENV_UD_CONTAINER_TYPE , "unknown-container" )
1515ERR_UDF_EXCEPTION_STRING = f"UDF_EXECUTION_ERROR({ CONTAINER_TYPE } )"
1616
Original file line number Diff line number Diff line change 55from pynumaflow ._constants import (
66 CONTAINER_TYPE ,
77 RUNTIME_APPLICATION_ERRORS_PATH ,
8- CURRENT_FILE ,
9- INTERNAL_ERROR ,
8+ CURRENT_CRITICAL_ERROR_FILE ,
9+ INTERNAL_ERROR_CODE ,
1010)
1111from pynumaflow .errors ._dtypes import _RuntimeErrorEntry
1212from typing import Union
@@ -62,8 +62,8 @@ def _persist_critical_error_to_file(
6262 container_dir = os .path .join (dir_path , CONTAINER_TYPE )
6363 os .makedirs (container_dir , mode = 0o777 , exist_ok = True )
6464
65- current_file_path = os .path .join (container_dir , CURRENT_FILE )
66- error_code = error_code or INTERNAL_ERROR
65+ current_file_path = os .path .join (container_dir , CURRENT_CRITICAL_ERROR_FILE )
66+ error_code = error_code or INTERNAL_ERROR_CODE
6767 current_timestamp = int (time .time ())
6868
6969 runtime_error_entry = _RuntimeErrorEntry (
Original file line number Diff line number Diff line change 55import unittest
66from pynumaflow .errors .errors import persist_critical_error , _persist_error_once
77from pynumaflow .errors .errors import _persist_critical_error_to_file
8- from pynumaflow ._constants import CONTAINER_TYPE , INTERNAL_ERROR
8+ from pynumaflow ._constants import CONTAINER_TYPE , INTERNAL_ERROR_CODE
99
1010
1111class TestErrorPersistence (unittest .TestCase ):
@@ -75,7 +75,7 @@ def test_uses_default_error_code_if_none_provided(self):
7575
7676 with open (os .path .join (container_dir , files [0 ])) as f :
7777 error_data = json .load (f )
78- self .assertEqual (error_data ["code" ], INTERNAL_ERROR )
78+ self .assertEqual (error_data ["code" ], INTERNAL_ERROR_CODE )
7979
8080 def test_persist_critical_error_all_threads_fail (self ):
8181 """
You can’t perform that action at this time.
0 commit comments