ganesh-vilje commited on
Commit
28f9d0d
·
1 Parent(s): b4b0135

fix: Add missing execution_id initialization

Browse files

Fixed NameError: 'execution_id is not defined'

- Initialize execution_id = session_id before use
- Added missing pipeline record creation code
- execution_id gets set from pipeline_manager.create_pipeline_record()
- Falls back to session_id if pipeline creation fails
- Fixed typo in processing message

This completes the pipeline record creation feature.

Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -1090,8 +1090,26 @@ Here's what I'll do:
1090
 
1091
  plan = session.get("proposed_pipeline", {})
1092
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1093
  # Initial status - User-friendly
1094
- initial_message = f"✅ **Approved!** Starting execution of: **{plan.get('pipeline_name', 'pipeline')}**\n\n🚀 Processingplease wait...\n_(Using {plan.get('_generator', 'AI')} - {plan.get('_model', 'model')})_"
1095
  yield format_chat_history(history, message, initial_message)
1096
 
1097
  steps_completed = []
 
1090
 
1091
  plan = session.get("proposed_pipeline", {})
1092
 
1093
+ # V3: Initialize execution_id before use (fallback to session_id)
1094
+ execution_id = session_id
1095
+
1096
+ # V3: Create pipeline record BEFORE execution
1097
+ try:
1098
+ pipeline_mgr = get_pipeline_manager()
1099
+ execution_id = pipeline_mgr.create_pipeline_record(
1100
+ session_id=session_id,
1101
+ pipeline_definition=plan,
1102
+ created_from="request",
1103
+ created_by_message=message
1104
+ )
1105
+ print(f"✅ Created pipeline record: {execution_id}")
1106
+ except Exception as e:
1107
+ print(f"⚠️ Failed to create pipeline record: {e}")
1108
+ print(f" Using session_id as fallback")
1109
+ # execution_id already initialized to session_id
1110
+
1111
  # Initial status - User-friendly
1112
+ initial_message = f"✅ **Approved!** Starting execution of: **{plan.get('pipeline_name', 'pipeline')}**\n\n🚀 Processing... please wait...\n_(Using {plan.get('_generator', 'AI')} - {plan.get('_model', 'model')})_"
1113
  yield format_chat_history(history, message, initial_message)
1114
 
1115
  steps_completed = []