Crash handler
setup_crash_handler()
Setup the environment to handle crashes, with crash tips and more.
Source code in src/super_gradients/common/crash_handler/crash_handler.py
9 10 11 12 13 14 15 16 17 18 19 |
|
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 src/super_gradients/common/crash_handler/crash_tips.py
13 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 |
|
__init_subclass__()
Register any class inheriting from CrashTip
Source code in src/super_gradients/common/crash_handler/crash_tips.py
26 27 28 |
|
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 src/super_gradients/common/crash_handler/crash_tips.py
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 |
|
get_sub_classes()
classmethod
Get all the classes inheriting from CrashTip
Source code in src/super_gradients/common/crash_handler/crash_tips.py
21 22 23 24 |
|
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 src/super_gradients/common/crash_handler/crash_tips.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
DDPNotInitializedTip
Bases: CrashTip
Note: I think that this should be caught within the code instead
Source code in src/super_gradients/common/crash_handler/crash_tips.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
RecipeFactoryFormatTip
Bases: CrashTip
Source code in src/super_gradients/common/crash_handler/crash_tips.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
WrongHydraVersionTip
Bases: CrashTip
Note: I think that this should be caught within the code instead
Source code in src/super_gradients/common/crash_handler/crash_tips.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
get_relevant_crash_tip_message(exc_type, exc_value, exc_traceback)
Get a CrashTip class if relevant for input exception
Source code in src/super_gradients/common/crash_handler/crash_tips.py
241 242 243 244 245 246 |
|
crash_tip_handler()
Display a crash tip if an error was raised
Source code in 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 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 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 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 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 src/super_gradients/common/crash_handler/exception_monitoring_setup.py
14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
setup_pro_user_monitoring()
Setup the pro user environment for error logging and monitoring
Source code in src/super_gradients/common/crash_handler/exception_monitoring_setup.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
fmt_txt(txt, bold=False, color='', indent=0)
Format a text for the console.
Source code in 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 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 src/super_gradients/common/crash_handler/utils.py
24 25 26 27 |
|