Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set HYDRA_FULL_ERROR #1291

Merged
merged 3 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/super_gradients/common/crash_handler/crash_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
from super_gradients.common.crash_handler.crash_tips_setup import setup_crash_tips
from super_gradients.common.crash_handler.exception_monitoring_setup import setup_pro_user_monitoring
from super_gradients.common.crash_handler.exception import register_exceptions
from super_gradients.common.environment.env_variables import env_variables


def setup_crash_handler():
"""Setup the environment to handle crashes, with crash tips and more."""
is_setup_crash_tips = setup_crash_tips()
is_setup_pro_user_monitoring = setup_pro_user_monitoring()
if is_setup_crash_tips or is_setup_pro_user_monitoring: # We don't want to wrap sys.excepthook when not required

# This prevents hydra.main to catch errors that happen in the decorated function
# (which leads sys.excepthook to never be called)
env_variables.HYDRA_FULL_ERROR = "1"

sys.excepthook = register_exceptions(sys.excepthook)
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging
import atexit

Expand Down Expand Up @@ -37,10 +36,6 @@ def setup_pro_user_monitoring() -> bool:
"If you do not have a deci-platform-client credentials or you wish to disable this feature, please set the env variable UPLOAD_LOGS=FALSE"
)

# This prevents hydra.main to catch errors that happen in the decorated function
# (which leads sys.excepthook to never be called)
os.environ["HYDRA_FULL_ERROR"] = "1"

logger.info("Connecting to the deci platform ...")
platform_client = DeciClient()
logger.info("Connection to the deci platform successful!")
Expand Down
9 changes: 9 additions & 0 deletions src/super_gradients/common/environment/env_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import Optional


class EnvironmentVariables:
Expand Down Expand Up @@ -36,5 +37,13 @@ def FILE_LOG_LEVEL(self) -> str:
def CONSOLE_LOG_LEVEL(self) -> str:
return os.getenv("CONSOLE_LOG_LEVEL", default="INFO").upper()

@property
def HYDRA_FULL_ERROR(self) -> Optional[str]:
return os.getenv("HYDRA_FULL_ERROR")

@HYDRA_FULL_ERROR.setter
def HYDRA_FULL_ERROR(self, value: str):
os.environ["HYDRA_FULL_ERROR"] = value


env_variables = EnvironmentVariables()