-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch_commands.py
More file actions
599 lines (518 loc) · 27.2 KB
/
Copy pathbatch_commands.py
File metadata and controls
599 lines (518 loc) · 27.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
"""
פקודות Batch לעיבוד מרובה קבצים
Batch Commands for Multiple File Processing
"""
import logging
import asyncio
from typing import Dict, Optional
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import ContextTypes, CommandHandler, CallbackQueryHandler
from telegram.constants import ParseMode
from database import db
from batch_processor import batch_processor
from lazy_loader import lazy_loader
from autocomplete_manager import autocomplete
from html import escape as html_escape
from batch_processor import BatchJob
logger = logging.getLogger(__name__)
async def batch_analyze_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""פקודת ניתוח batch של קבצים"""
user_id = update.effective_user.id
if not context.args:
await update.message.reply_text(
"📊 <b>ניתוח Batch של קבצים</b>\n\n"
"שימוש:\n"
"• <code>/batch_analyze all</code> - ניתוח כל הקבצים\n"
"• <code>/batch_analyze python</code> - ניתוח קבצי Python בלבד\n"
"• <code>/batch_analyze file1.py file2.js</code> - ניתוח קבצים ספציפיים\n\n"
"💡 הפעולה תתבצע ברקע ותקבל עדכונים",
parse_mode=ParseMode.HTML
)
return
# זיהוי סוג הבקשה
args = context.args
files_to_analyze = []
if args[0] == "all":
# כל הקבצים
try:
all_files = db.get_user_files(user_id, limit=500, projection={"file_name": 1})
except TypeError:
# תאימות ל-stubs בטסטים
all_files = db.get_user_files(user_id, 500)
files_to_analyze = [f['file_name'] for f in all_files if f.get('file_name')]
elif args[0] in ['python', 'javascript', 'java', 'cpp', 'html', 'css']:
# קבצים לפי שפה
language = args[0]
try:
all_files = db.get_user_files(user_id, limit=500, projection={"file_name": 1, "programming_language": 1})
except TypeError:
all_files = db.get_user_files(user_id, 500)
files_to_analyze = [
f['file_name'] for f in all_files
if f.get('programming_language', '').lower() == language.lower()
]
else:
# קבצים ספציפיים
files_to_analyze = args
if not files_to_analyze:
await update.message.reply_text(
"❌ לא נמצאו קבצים לניתוח\n\n"
"💡 בדוק שהקבצים קיימים או השפה נכונה",
parse_mode=ParseMode.HTML
)
return
# יצירת עבודת batch
try:
job_id = await batch_processor.analyze_files_batch(user_id, files_to_analyze)
# הודעת התחלה
keyboard = [[
InlineKeyboardButton("📊 בדוק סטטוס", callback_data=f"job_status:{job_id}"),
InlineKeyboardButton("❌ בטל", callback_data=f"job_cancel:{job_id}")
]]
reply_markup = InlineKeyboardMarkup(keyboard)
await update.message.reply_text(
f"⚡ <b>ניתוח Batch התחיל!</b>\n\n"
f"📁 מנתח {len(files_to_analyze)} קבצים\n"
f"🆔 Job ID: <code>{job_id}</code>\n\n"
f"⏱️ זמן משוער: {len(files_to_analyze) * 2} שניות",
parse_mode=ParseMode.HTML,
reply_markup=reply_markup
)
try:
# יצירת רענון אוטומטי להודעת הסטטוס (אם conversation_handlers זמין)
from conversation_handlers import _auto_update_batch_status
sent = await update.message.reply_text(
f"📊 <b>סטטוס עבודת Batch</b>\n\n🆔 <code>{job_id}</code>",
parse_mode=ParseMode.HTML,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🔄 רענן", callback_data=f"job_status:{job_id}")]])
)
asyncio.create_task(_auto_update_batch_status(context.application, sent.chat_id, sent.message_id, job_id, user_id))
except Exception:
pass
except Exception as e:
logger.error(f"שגיאה בהתחלת ניתוח batch: {e}")
await update.message.reply_text("❌ שגיאה בהתחלת הניתוח")
async def batch_validate_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""פקודת בדיקת תקינות batch"""
user_id = update.effective_user.id
if not context.args:
await update.message.reply_text(
"✅ <b>בדיקת תקינות Batch</b>\n\n"
"שימוש:\n"
"• <code>/batch_validate all</code> - בדיקת כל הקבצים\n"
"• <code>/batch_validate python</code> - בדיקת קבצי Python\n"
"• <code>/batch_validate file1.py file2.js</code> - בדיקת קבצים ספציפיים",
parse_mode=ParseMode.HTML
)
return
# זיהוי קבצים (אותה לוגיקה כמו analyze)
args = context.args
files_to_validate = []
if args[0] == "all":
try:
all_files = db.get_user_files(user_id, limit=500, projection={"file_name": 1})
except TypeError:
all_files = db.get_user_files(user_id, 500)
files_to_validate = [f['file_name'] for f in all_files if f.get('file_name')]
elif args[0] in ['python', 'javascript', 'java', 'cpp']:
language = args[0]
try:
all_files = db.get_user_files(user_id, limit=500, projection={"file_name": 1, "programming_language": 1})
except TypeError:
all_files = db.get_user_files(user_id, 500)
files_to_validate = [
f['file_name'] for f in all_files
if f.get('programming_language', '').lower() == language.lower()
]
else:
files_to_validate = args
if not files_to_validate:
await update.message.reply_text("❌ לא נמצאו קבצים לבדיקה")
return
try:
job_id = await batch_processor.validate_files_batch(user_id, files_to_validate)
keyboard = [[
InlineKeyboardButton("📊 בדוק סטטוס", callback_data=f"job_status:{job_id}")
]]
reply_markup = InlineKeyboardMarkup(keyboard)
await update.message.reply_text(
f"✅ <b>בדיקת תקינות Batch התחילה!</b>\n\n"
f"📁 בודק {len(files_to_validate)} קבצים\n"
f"🆔 Job ID: <code>{job_id}</code>",
parse_mode=ParseMode.HTML,
reply_markup=reply_markup
)
try:
from conversation_handlers import _auto_update_batch_status
sent = await update.message.reply_text(
f"📊 <b>סטטוס עבודת Batch</b>\n\n🆔 <code>{job_id}</code>",
parse_mode=ParseMode.HTML,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🔄 רענן", callback_data=f"job_status:{job_id}")]])
)
asyncio.create_task(_auto_update_batch_status(context.application, sent.chat_id, sent.message_id, job_id, user_id))
except Exception:
pass
except Exception as e:
logger.error(f"שגיאה בהתחלת בדיקת batch: {e}")
await update.message.reply_text("❌ שגיאה בהתחלת הבדיקה")
async def job_status_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""בדיקת סטטוס עבודת batch"""
user_id = update.effective_user.id
if not context.args:
# הצגת כל העבודות הפעילות
active_jobs = [
job for job in batch_processor.active_jobs.values()
if job.user_id == user_id
]
if not active_jobs:
await update.message.reply_text(
"📋 אין עבודות batch פעילות\n\n"
"💡 שימוש: <code>/job_status <job_id></code>",
parse_mode=ParseMode.HTML
)
return
# הצגת רשימת עבודות
keyboard = []
for job in active_jobs[-5:]: # 5 עבודות אחרונות
keyboard.append([
InlineKeyboardButton(
f"{job.operation} - {job.status}",
callback_data=f"job_status:{job.job_id}"
)
])
reply_markup = InlineKeyboardMarkup(keyboard)
await update.message.reply_text(
f"📋 <b>עבודות Batch פעילות ({len(active_jobs)}):</b>",
parse_mode=ParseMode.HTML,
reply_markup=reply_markup
)
return
job_id = " ".join(context.args)
job: Optional[BatchJob] = batch_processor.get_job_status(job_id)
if not job:
await update.message.reply_text(
f"❌ עבודת batch '{html_escape(job_id)}' לא נמצאה",
parse_mode=ParseMode.HTML
)
return
if job.user_id != user_id:
await update.message.reply_text("❌ אין הרשאה לצפות בעבודה זו")
return
# הצגת סטטוס מפורט
summary = batch_processor.format_job_summary(job)
keyboard = []
if job.status == "completed":
keyboard.append([
InlineKeyboardButton("📋 הצג תוצאות", callback_data=f"job_results:{job_id}")
])
elif job.status == "running":
keyboard.append([
InlineKeyboardButton("🔄 רענן", callback_data=f"job_status:{job_id}")
])
reply_markup = InlineKeyboardMarkup(keyboard) if keyboard else None
await update.message.reply_text(
f"📊 <b>סטטוס עבודת Batch</b>\n\n"
f"🆔 <code>{job_id}</code>\n"
f"🔧 <b>פעולה:</b> {job.operation}\n\n"
f"{summary}",
parse_mode=ParseMode.HTML,
reply_markup=reply_markup
)
async def large_file_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""פקודת הצגת קובץ גדול עם lazy loading"""
user_id = update.effective_user.id
if not context.args:
await update.message.reply_text(
"📄 <b>הצגת קובץ גדול</b>\n\n"
"שימוש: <code>/large <שם_קובץ></code>\n\n"
"💡 קבצים גדולים יוצגו בחלקים לנוחיות",
parse_mode=ParseMode.HTML
)
return
file_name = " ".join(context.args)
file_data = db.get_latest_version(user_id, file_name)
if not file_data:
# הצעת אוטו-השלמה
suggestions = autocomplete.suggest_filenames(user_id, file_name, limit=3)
if suggestions:
suggestion_text = "\n".join([f"• {s['display']}" for s in suggestions])
await update.message.reply_text(
f"❌ קובץ '{html_escape(file_name)}' לא נמצא\n\n"
f"🔍 <b>האם התכוונת ל:</b>\n{suggestion_text}",
parse_mode=ParseMode.HTML
)
else:
await update.message.reply_text(
f"❌ קובץ '{html_escape(file_name)}' לא נמצא",
parse_mode=ParseMode.HTML
)
return
code = file_data['code']
# בדיקה אם הקובץ גדול
if lazy_loader.is_large_file(code):
# הצגה עם lazy loading
await lazy_loader.show_large_file_lazy(update, user_id, file_name, chunk_index=0)
else:
# קובץ רגיל - הצגה רגילה
show_command = f"/show {file_name}"
await update.message.reply_text(
f"📄 <b>{html_escape(file_name)}</b>\n\n"
f"ℹ️ קובץ זה אינו גדול ({len(code.splitlines())} שורות)\n"
f"השתמש ב-<code>{html_escape(show_command)}</code> להצגה רגילה",
parse_mode=ParseMode.HTML
)
async def handle_batch_callbacks(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""טיפול בcallbacks של batch operations"""
query = update.callback_query
await query.answer(cache_time=0)
user_id = update.effective_user.id
data = query.data
try:
if data.startswith("job_status:"):
job_id = data[11:] # הסרת "job_status:"
from typing import Optional
job: Optional[BatchJob] = batch_processor.get_job_status(job_id)
if not job or job.user_id != user_id:
await query.edit_message_text("❌ עבודה לא נמצאה")
return
summary = batch_processor.format_job_summary(job)
keyboard = []
if job.status == "completed":
keyboard.append([
InlineKeyboardButton("📋 הצג תוצאות", callback_data=f"job_results:{job_id}")
])
elif job.status == "running":
keyboard.append([
InlineKeyboardButton("🔄 רענן", callback_data=f"job_status:{job_id}")
])
reply_markup = InlineKeyboardMarkup(keyboard) if keyboard else None
await query.edit_message_text(
f"📊 <b>סטטוס עבודת Batch</b>\n\n"
f"🆔 <code>{job_id}</code>\n"
f"🔧 <b>פעולה:</b> {job.operation}\n\n"
f"{summary}",
parse_mode=ParseMode.HTML,
reply_markup=reply_markup
)
elif data.startswith("job_results:"):
job_id = data[12:] # הסרת "job_results:"
from typing import Optional
job: Optional[BatchJob] = batch_processor.get_job_status(job_id)
if not job or job.user_id != user_id:
await query.edit_message_text("❌ עבודה לא נמצאה")
return
if job.status != "completed":
await query.edit_message_text("⏳ עבודה עדיין לא הושלמה")
return
# בדיקת סוג הפעולה
is_analyze = job.operation == "analyze"
# הצגת תוצאות מפורטות
if is_analyze:
results_text = "📊 <b>תוצאות ניתוח הקוד</b>\n"
else:
results_text = "🔍 <b>תוצאות בדיקת התקינות</b>\n"
results_text += "━━━━━━━━━━━━━━━━━━━━\n\n"
successful_files = []
failed_files = []
for file_name, result in job.results.items():
if result.get('success', False):
successful_files.append(file_name)
else:
failed_files.append((file_name, result.get('error', 'שגיאה לא ידועה')))
# סטטיסטיקות כלליות
total_files = len(job.results)
results_text += f"📈 <b>סטטיסטיקות:</b>\n"
results_text += f" • סה״כ קבצים: <b>{total_files}</b>\n"
results_text += f" • ✅ עברו בהצלחה: <b>{len(successful_files)}</b>\n"
results_text += f" • ❌ נכשלו: <b>{len(failed_files)}</b>\n\n"
if successful_files:
results_text += f"✅ <b>קבצים שעברו בהצלחה ({len(successful_files)}):</b>\n"
for file_name in successful_files[:10]: # הצג עד 10
results_text += f" • <code>{html_escape(file_name)}</code>\n"
if len(successful_files) > 10:
results_text += f" <i>... ועוד {len(successful_files) - 10} קבצים</i>\n"
results_text += "\n"
if failed_files:
results_text += f"❌ <b>קבצים עם בעיות ({len(failed_files)}):</b>\n"
for file_name, error in failed_files[:5]: # הצג עד 5 שגיאות
results_text += f" • <code>{html_escape(file_name)}</code>\n"
results_text += f" └ {html_escape(error[:50])}...\n"
if len(failed_files) > 5:
results_text += f" <i>... ועוד {len(failed_files) - 5} קבצים</i>\n"
results_text += "\n"
# תקציר בדיקות מתקדמות (אם קיימות)
detailed_advanced = []
for file_name, result in job.results.items():
adv = result.get('result', {}).get('advanced_checks') if result.get('result') else None
if adv:
file_issues = []
for tool, tool_res in adv.items():
rc = tool_res.get('returncode')
# תרגום שמות הכלים
tool_name = {
'flake8': '🔍 בדיקת סגנון',
'mypy': '📝 בדיקת טיפוסים',
'bandit': '🔒 בדיקת אבטחה',
'black': '🎨 עיצוב קוד',
'pylint': '🔎 ניהול אזהרות (pylint)',
'isort': '📦 סדר ייבואים (isort)',
'radon_cc': '📈 מורכבות (radon cc)',
'radon_mi': '🧪 מדד תחזוקתיות (radon mi)',
'eslint': '🧩 ESLint',
'tsc': '🔤 TypeScript tsc',
'prettier': '🎨 Prettier check',
'shellcheck': '🛡️ ShellCheck',
'yamllint': '📜 YAML Lint',
'hadolint': '🐳 Hadolint',
'jq': '🧰 jq (JSON)',
'semgrep': '🛡️ Semgrep',
'secrets_scan': '🔑 גילוי סודות'
}.get(tool, tool)
if rc == 0:
status_icon = '✅'
status_text = 'תקין'
elif rc == 127:
status_icon = '⚠️'
status_text = 'כלי חסר'
elif rc == 124:
status_icon = '⏱️'
status_text = 'תם הזמן'
else:
status_icon = '❌'
status_text = 'בעיה'
out = (tool_res.get('output') or '').splitlines()
if out:
# ניקוי ותרגום השגיאה
error_msg = out[0][:100]
if 'imported but unused' in error_msg:
error_msg = 'ייבוא לא בשימוש'
elif 'would reformat' in error_msg:
error_msg = 'דורש עיצוב מחדש'
elif 'SyntaxError' in error_msg:
error_msg = 'שגיאת תחביר'
elif 'invalid syntax' in error_msg:
error_msg = 'תחביר לא תקין'
elif tool in ('semgrep',):
error_msg = 'ממצאים בקוד (semgrep)'
elif tool == 'secrets_scan':
error_msg = 'חשד לסודות בקוד'
else:
error_msg = html_escape(error_msg[:50])
status_text = f"{status_text}: {error_msg}"
file_issues.append(f" {status_icon} {tool_name}: <b>{status_text}</b>")
if file_issues:
detailed_advanced.append(f"\n 📄 <code>{html_escape(file_name)}</code>\n" + "\n".join(file_issues))
if detailed_advanced:
results_text += "🧪 <b>בדיקות מתקדמות לקבצי Python:</b>\n"
results_text += "━━━━━━━━━━━━━━━━━━━━\n"
for details in detailed_advanced[:5]:
results_text += details + "\n"
if len(detailed_advanced) > 5:
results_text += f"\n <i>... ועוד {len(detailed_advanced) - 5} קבצים נבדקו</i>"
# פירוט תוצאות בדיקת תקינות (Validate) לכל קובץ
if not is_analyze:
per_file_lines = []
for file_name, res in job.results.items():
if not res.get('result'):
continue
data = res['result']
ok = data.get('is_valid')
lang = data.get('language') or 'לא ידוע'
orig_len = data.get('original_length', 0)
clean_len = data.get('cleaned_length', 0)
err_msg = data.get('error_message') or ''
status_icon = '✅' if ok else '❌'
# שורה ראשית
per_file_lines.append(
f"{status_icon} <code>{html_escape(file_name)}</code> — שפה: <b>{html_escape(lang)}</b> — תווים: {clean_len:,}/{orig_len:,}"
)
# פירוט שגיאה אם קיים
if not ok and err_msg:
short_err = html_escape(err_msg[:120])
per_file_lines.append(f" └ שגיאה: {short_err}")
if per_file_lines:
results_text += "\n🧾 <b>פירוט לקבצים שנבדקו:</b>\n"
results_text += "\n".join(per_file_lines[:30]) # הנחיה: הצג עד 30
if len(per_file_lines) > 30:
results_text += f"\n<i>... ועוד {len(per_file_lines) - 30} קבצים</i>\n"
# אם זה ניתוח, הוסף מידע נוסף
if is_analyze:
analysis_summary = []
total_lines = 0
total_chars = 0
languages: Dict[str, int] = {}
for file_name, result in job.results.items():
if result.get('success', False):
res_data = result.get('result', {})
if res_data:
total_lines += res_data.get('lines', 0)
total_chars += res_data.get('chars', 0)
lang = res_data.get('language', 'unknown')
languages[lang] = languages.get(lang, 0) + 1
# אם יש ניתוח מפורט
analysis = res_data.get('analysis', {})
if analysis and isinstance(analysis, dict):
complexity = analysis.get('complexity', 'N/A')
quality_score = analysis.get('quality_score', 'N/A')
if complexity != 'N/A' or quality_score != 'N/A':
analysis_summary.append({
'file': file_name,
'complexity': complexity,
'quality': quality_score
})
# הוסף סיכום ניתוח
if total_lines > 0:
results_text += "\n📈 <b>סיכום הניתוח:</b>\n"
results_text += "━━━━━━━━━━━━━━━━━━━━\n"
results_text += f" 📏 סה״כ שורות קוד: <b>{total_lines:,}</b>\n"
results_text += f" 📝 סה״כ תווים: <b>{total_chars:,}</b>\n"
if languages:
results_text += f"\n 🔤 <b>שפות תכנות:</b>\n"
for lang, count in sorted(languages.items(), key=lambda x: x[1], reverse=True):
lang_display = lang.title() if lang != 'unknown' else 'לא זוהה'
results_text += f" • {lang_display}: <b>{count}</b> קבצים\n"
if analysis_summary:
results_text += f"\n 🎯 <b>ציוני איכות (דוגמאות):</b>\n"
for item in analysis_summary[:3]:
results_text += f" • <code>{html_escape(item['file'])}</code>\n"
if item['quality'] != 'N/A':
results_text += f" ציון איכות: <b>{item['quality']}</b>\n"
if item['complexity'] != 'N/A':
results_text += f" מורכבות: <b>{item['complexity']}</b>\n"
await query.edit_message_text(
results_text,
parse_mode=ParseMode.HTML
)
elif data.startswith("chunk:"):
# טיפול בnavigation של chunks
parts = data.split(":")
if len(parts) == 3:
file_name = parts[1]
chunk_index = int(parts[2])
await lazy_loader.show_large_file_lazy(query, user_id, file_name, chunk_index)
elif data.startswith("job_cancel:"):
# ביטול עבודה
job_id = data[11:]
try:
ok = batch_processor.cancel_job(job_id)
except Exception:
ok = False
if ok:
await query.edit_message_text("✅ העבודה בוטלה בהצלחה")
else:
await query.edit_message_text("❌ לא ניתן לבטל את העבודה")
except Exception as e:
logger.error(f"שגיאה בטיפול ב-batch callback: {e}")
await query.edit_message_text("❌ שגיאה בעיבוד הבקשה")
def setup_batch_handlers(application):
"""הוספת handlers לפקודות batch"""
application.add_handler(CommandHandler("batch_analyze", batch_analyze_command))
application.add_handler(CommandHandler("batch_validate", batch_validate_command))
application.add_handler(CommandHandler("job_status", job_status_command))
application.add_handler(CommandHandler("large", large_file_command))
# הוספת callback handlers
application.add_handler(CallbackQueryHandler(
handle_batch_callbacks,
pattern="^(job_status:|job_results:|job_cancel:|chunk:)"
))
logger.info("Batch handlers הוגדרו בהצלחה")