Crash handler
setup_crash_handler()
Setup the environment to handle crashes, with crash tips and more.
Source code in V3_2/src/super_gradients/common/crash_handler/crash_handler.py
8 9 10 11 12 13 |
|
CrashTip
Base class to add tips to exceptions raised while using SuperGradients.
A tip is a more informative message with some suggestions for possible solutions or places to debug.
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
__init_subclass__()
Register any class inheriting from CrashTip
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
27 28 29 |
|
get_message(exc_type, exc_value, exc_traceback)
classmethod
Wrap the tip in a nice message.
Beside the class, the input params are as returned by sys.exc_info(): :param cls: Class inheriting from CrashTip :param exc_type: Type of exception :param exc_value: Exception :param exc_traceback: Traceback
:return: Tip
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
get_sub_classes()
classmethod
Get all the classes inheriting from CrashTip
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
22 23 24 25 |
|
is_relevant(exc_type, exc_value, exc_traceback)
classmethod
Check if this tip is relevant.
Beside the class, the input params are as returned by sys.exc_info(): :param cls: Class inheriting from CrashTip :param exc_type: Type of exception :param exc_value: Exception :param exc_traceback: Traceback
:return: True if the current class can help with the exception
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
DDPNotInitializedTip
Bases: CrashTip
Note: I think that this should be caught within the code instead
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
RecipeFactoryFormatTip
Bases: CrashTip
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
WrongHydraVersionTip
Bases: CrashTip
Note: I think that this should be caught within the code instead
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
get_relevant_crash_tip_message(exc_type, exc_value, exc_traceback)
Get a CrashTip class if relevant for input exception
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips.py
224 225 226 227 228 229 |
|
crash_tip_handler()
Display a crash tip if an error was raised
Source code in V3_2/src/super_gradients/common/crash_handler/crash_tips_setup.py
10 11 12 13 14 |
|
ExceptionInfo
Holds information about the session exception (if any)
Source code in V3_2/src/super_gradients/common/crash_handler/exception.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
is_exception_raised()
staticmethod
Check if an exception was raised in the current process
Source code in V3_2/src/super_gradients/common/crash_handler/exception.py
39 40 41 42 |
|
register_exception(exc_type, exc_value, exc_traceback)
staticmethod
Register the exception information into the class
Source code in V3_2/src/super_gradients/common/crash_handler/exception.py
31 32 33 34 35 36 37 |
|
register_exceptions(excepthook)
Wrap excepthook with a step the saves the exception info to be available in the exit hooks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exc_type |
Type of exception |
required | |
exc_value |
Exception |
required | |
exc_traceback |
Traceback |
required |
Returns:
Type | Description |
---|---|
Callable
|
wrapped exceptook, that register the exception before raising it |
Source code in V3_2/src/super_gradients/common/crash_handler/exception.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
exception_upload_handler(platform_client)
Upload the log file to the deci platform if an error was raised
Source code in V3_2/src/super_gradients/common/crash_handler/exception_monitoring_setup.py
15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
setup_pro_user_monitoring()
Setup the pro user environment for error logging and monitoring
Source code in V3_2/src/super_gradients/common/crash_handler/exception_monitoring_setup.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
fmt_txt(txt, bold=False, color='', indent=0)
Format a text for the console.
Source code in V3_2/src/super_gradients/common/crash_handler/utils.py
11 12 13 14 15 16 17 18 19 20 21 |
|
indent_string(txt, indent_size)
Add an indentation to a string.
Source code in V3_2/src/super_gradients/common/crash_handler/utils.py
5 6 7 8 |
|
json_str_to_dict(json_str)
Build a dictionary from a string in some sort of format.
Source code in V3_2/src/super_gradients/common/crash_handler/utils.py
24 25 26 27 |
|