sagemaker.core.debugger.utils#
Utils file that contains util functions for the profiler.
Functions
|
Helper function to convert the dictionary config to a string. |
|
Helper function to determine whether the provided regex is valid. |
|
Helper function to determine whether the provided UNIX time is valid. |
Classes
|
Enum to store all possible messages during failures in validation of user arguments. |
|
Enum to list the Python profiler options for Python profiling. |
|
Enum to list the possible cProfile timers for Python profiling. |
- class sagemaker.core.debugger.utils.ErrorMessages(value)[source]#
Bases:
EnumEnum to store all possible messages during failures in validation of user arguments.
- FOUND_BOTH_STEP_AND_TIME_FIELDS = 'Both step and time fields cannot be specified in the metrics config!'#
- INVALID_CPROFILE_TIMER = 'cprofile_timer must be of type cProfileTimer'#
- INVALID_DURATION = 'duration must be float greater than 0!'#
- INVALID_FILE_CLOSE_INTERVAL = 'file_close_interval must be a float/integer greater than 0!'#
- INVALID_FILE_MAX_SIZE = 'file_max_size must be an integer greater than 0!'#
- INVALID_FILE_OPEN_FAIL_THRESHOLD = 'file_open_fail threshold must be an integer greater than 0!'#
- INVALID_LOCAL_PATH = 'local_path must be a string!'#
- INVALID_METRICS_REGEX = 'metrics_regex is invalid!'#
- INVALID_NUM_STEPS = 'num_steps must be integer greater than 0!'#
- INVALID_PROFILE_DEFAULT_STEPS = 'profile_default_steps must be a boolean!'#
- INVALID_PYTHON_PROFILER = 'python_profiler must be of type PythonProfiler!'#
- INVALID_START_STEP = 'start_step must be integer greater or equal to 0!'#
- INVALID_START_UNIX_TIME = 'start_unix_time must be valid integer unix time!'#
- class sagemaker.core.debugger.utils.PythonProfiler(value)[source]#
Bases:
EnumEnum to list the Python profiler options for Python profiling.
- CPROFILE#
Use to choose
"cProfile".
- PYINSTRUMENT#
Use to choose
"Pyinstrument".
- CPROFILE = 'cprofile'#
- PYINSTRUMENT = 'pyinstrument'#
- class sagemaker.core.debugger.utils.cProfileTimer(value)[source]#
Bases:
EnumEnum to list the possible cProfile timers for Python profiling.
- TOTAL_TIME#
Use to choose
"total_time".
- CPU_TIME#
Use to choose
"cpu_time".
- OFF_CPU_TIME#
Use to choose
"off_cpu_time".
- CPU_TIME = 'cpu_time'#
- DEFAULT = 'default'#
- OFF_CPU_TIME = 'off_cpu_time'#
- TOTAL_TIME = 'total_time'#
- sagemaker.core.debugger.utils.convert_json_config_to_string(config)[source]#
Helper function to convert the dictionary config to a string.
Calling eval on this string should result in the original dictionary.
- Parameters:
config (dict) – The config to be converted to a string.
- Returns:
The config dictionary formatted as a string.
- Return type:
str