Add debug logs to trace debug value inheritance from main process to workers

parent 3e6f1613
......@@ -33,27 +33,33 @@ def initialize_config(cli_args=None) -> None:
initial_config = load_initial_config(cli_args)
# Special handling for debug: reset to false unless explicitly set via CLI or env var
# (config files are ignored for debug to prevent persistent debug settings)
# Special handling for debug: reset to false unless explicitly set via CLI, env var, or config file
debug_explicitly_set = False
if cli_args and hasattr(cli_args, 'debug') and cli_args.debug:
debug_explicitly_set = True
if f'VIDAI_DEBUG' in os.environ:
elif f'VIDAI_DEBUG' in os.environ:
debug_explicitly_set = True
elif 'debug' in initial_config and initial_config['debug'] != DEFAULTS['debug']:
debug_explicitly_set = True
if not debug_explicitly_set:
# Reset debug to false if not explicitly set via CLI or env
# Reset debug to false if not explicitly set via CLI, env, or config file
initial_config['debug'] = 'false'
print(f"MAIN_DEBUG_SET: debug reset to false (not explicitly set)")
else:
print(f"MAIN_DEBUG_SET: debug kept as {initial_config['debug']} (explicitly set)")
# Special handling for debug_web: same logic as debug
debug_web_explicitly_set = False
if cli_args and hasattr(cli_args, 'debug_web') and cli_args.debug_web:
debug_web_explicitly_set = True
if f'VIDAI_DEBUG_WEB' in os.environ:
elif f'VIDAI_DEBUG_WEB' in os.environ:
debug_web_explicitly_set = True
elif 'debug_web' in initial_config and initial_config['debug_web'] != DEFAULTS['debug_web']:
debug_web_explicitly_set = True
if not debug_web_explicitly_set:
# Reset debug_web to false if not explicitly set via CLI or env
# Reset debug_web to false if not explicitly set via CLI, env, or config file
initial_config['debug_web'] = 'false'
# Store all environment variables that start with VIDAI_
......
......@@ -451,6 +451,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id_int=None,
return result, total_tokens
def worker_process(backend_type: str):
"""Main worker process."""
print(f"WORKER_DEBUG_READ: get_debug() = {get_debug()}")
if get_debug():
print(f"DEBUG: Starting Analysis Worker for {backend_type}...")
print(f"DEBUG: Worker PID: {os.getpid()}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment