Add stdout progress logging to workers for job status visibility without --debug flag

parent dddbc59b
...@@ -201,6 +201,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm ...@@ -201,6 +201,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message': f'Extracted {total_frames} frames' 'message': f'Extracted {total_frames} frames'
}) })
comm.send_message(progress_msg) comm.send_message(progress_msg)
print(f"PROGRESS: Job {job_id} - 10% - Extracted {total_frames} frames")
descriptions = [] descriptions = []
...@@ -239,6 +240,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm ...@@ -239,6 +240,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message': f'Analyzed frame {i+1}/{total_frames}' 'message': f'Analyzed frame {i+1}/{total_frames}'
}) })
comm.send_message(progress_msg) comm.send_message(progress_msg)
print(f"PROGRESS: Job {job_id} - {progress_percent}% - Analyzed frame {i+1}/{total_frames}")
if output_dir: if output_dir:
import shutil import shutil
...@@ -255,6 +257,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm ...@@ -255,6 +257,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message': 'Generating video summary' 'message': 'Generating video summary'
}) })
comm.send_message(progress_msg) comm.send_message(progress_msg)
print(f"PROGRESS: Job {job_id} - 85% - Generating video summary")
# Check for cancellation before summary # Check for cancellation before summary
if job_id and check_job_cancelled(job_id): if job_id and check_job_cancelled(job_id):
...@@ -283,6 +286,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm ...@@ -283,6 +286,7 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message': 'Analysis completed' 'message': 'Analysis completed'
}) })
comm.send_message(progress_msg) comm.send_message(progress_msg)
print(f"PROGRESS: Job {job_id} - 100% - Analysis completed")
result = f"Frame Descriptions:\n" + "\n".join(descriptions) + f"\n\nSummary:\n{summary}" result = f"Frame Descriptions:\n" + "\n".join(descriptions) + f"\n\nSummary:\n{summary}"
return result, total_tokens return result, total_tokens
...@@ -353,6 +357,7 @@ def worker_process(backend_type: str): ...@@ -353,6 +357,7 @@ def worker_process(backend_type: str):
model_path = data.get('model_path', 'Qwen/Qwen2.5-VL-7B-Instruct') model_path = data.get('model_path', 'Qwen/Qwen2.5-VL-7B-Instruct')
interval = data.get('interval', 10) interval = data.get('interval', 10)
job_id = message.msg_id # Use message ID for job identification job_id = message.msg_id # Use message ID for job identification
print(f"PROGRESS: Job {message.msg_id} accepted - Starting analysis")
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, comm) result, tokens_used = analyze_media(media_path, prompt, model_path, interval, job_id, comm)
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")
......
...@@ -70,8 +70,10 @@ def worker_process(backend_type: str): ...@@ -70,8 +70,10 @@ def worker_process(backend_type: str):
train_dir = data.get('train_dir', '') train_dir = data.get('train_dir', '')
if train_dir and os.path.isdir(train_dir): if train_dir and os.path.isdir(train_dir):
print(f"PROGRESS: Job {message.msg_id} accepted - Starting training")
print(f"DEBUG: Starting training for job {message.msg_id}") print(f"DEBUG: Starting training for job {message.msg_id}")
result = train_model(train_dir, output_model, description) result = train_model(train_dir, output_model, description)
print(f"PROGRESS: Job {message.msg_id} - 100% - Training completed")
print(f"DEBUG: Training completed for job {message.msg_id}") print(f"DEBUG: Training completed for job {message.msg_id}")
else: else:
result = "No valid training directory provided" result = "No valid training directory provided"
......
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