Fix undefined job_id variable in analyze_media function

parent 1e224c1d
...@@ -181,8 +181,9 @@ def check_job_cancelled(job_id): ...@@ -181,8 +181,9 @@ def check_job_cancelled(job_id):
except: except:
return False return False
def analyze_media(media_path, prompt, model_path, interval=10, job_id_int=None, comm=None): def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm=None):
"""Analyze media using dynamic model loading.""" """Analyze media using dynamic model loading."""
job_id_int = int(job_id.split('_')[1]) if job_id else None
if get_debug(): if get_debug():
print(f"DEBUG: Starting analyze_media for job {job_id_int}, media_path={media_path}") print(f"DEBUG: Starting analyze_media for job {job_id_int}, media_path={media_path}")
...@@ -493,7 +494,7 @@ def worker_process(backend_type: str): ...@@ -493,7 +494,7 @@ def worker_process(backend_type: str):
print(f"PROGRESS: Job {job_id_int} accepted - Starting analysis") print(f"PROGRESS: Job {job_id_int} accepted - Starting analysis")
if get_debug(): if get_debug():
print(f"DEBUG: Starting analysis of {media_path} with model {model_path} for job {job_id}") print(f"DEBUG: Starting analysis of {media_path} with model {model_path} for job {job_id}")
result, tokens_used = analyze_media(media_path, prompt, model_path, interval, job_id_int, comm) result, tokens_used = analyze_media(media_path, prompt, model_path, interval, job_id, comm)
if get_debug(): if get_debug():
print(f"DEBUG: Analysis completed for job {message.msg_id}, used {tokens_used} tokens") print(f"DEBUG: Analysis completed for job {message.msg_id}, used {tokens_used} tokens")
......
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