
    uʴh                        S r SSKrSSKJr  SSKJr  \R                  R                  SS5        \" S5      r\R                  SS	S
9  \R                  5         SS0SS0SS0SS0S.\R                  l        S\R                  l        SSS.SSS.SSS.SSS.S.\R                  l        \R                  R                  SSSSSSS/\R                   SSSSSS9  SSSS .S!S"S#S .S$S%S&S .S'.\R                  l        S\R                  l        S\R                  l        \" \S(5      (       a  \R*                  \R                  l        \R/                  SS)9S* 5       r\R/                  SS)9S+ 5       rg),a  
Celery configuration for Stream Processor Django project.

This module configures Celery for handling background tasks such as:
- Stream capture and processing
- Jingle detection and ad break analysis
- Telegram notification sending
- Periodic maintenance tasks
- File system monitoring

Celery allows the application to process time-consuming tasks asynchronously,
improving user experience and system responsiveness.
    N)Celery)settingsDJANGO_SETTINGS_MODULEzcore.settingscorezdjango.conf:settingsCELERY)	namespacequeuestream_processingjingle_detectionnotifications
monitoring)zapps.streams.tasks.*zapps.jingles.tasks.*zapps.notifications.tasks.*zapps.monitoring.tasks.*default)exchangerouting_key)r
   r   r   r   i  iX  i  gzipjsonT   i  )result_expirestask_time_limittask_soft_time_limitresult_compressiontask_serializerresult_serializeraccept_contenttimezone
enable_utcworker_prefetch_multiplierworker_max_tasks_per_childtask_acks_latetask_reject_on_worker_lostz10/m   <   )
rate_limitmax_retriesdefault_retry_delayz50/m      z100/m   
   )z!apps.streams.tasks.capture_streamz apps.jingles.tasks.detect_jinglez.apps.notifications.tasks.send_telegram_messageCELERY_BEAT_SCHEDULE)bindc                 f    [        SU R                  < 35        SU R                  R                   3$ )aC  
Debug task for testing Celery configuration.

This task can be used to verify that Celery is properly configured
and can execute tasks. It's primarily used for debugging and testing.

Args:
    self: The task instance (automatically provided by bind=True)
    
Returns:
    str: Debug information about the task execution
z	Request: z$Debug task executed successfully at )printrequestid)selfs    7C:\Users\brahi\OneDrive\Desktop\Code\src\core\celery.py
debug_taskr2      s.     
Idll%
&'1$,,//1BCC    c                     SSK Jn  [        SU SU 35        [        R                  R                  S5      (       a  UR                  SU SU 35        g)	a  
Handle task failures for monitoring and alerting.

This task is called when other tasks fail, allowing for centralized
error handling, logging, and notification of failures.

Args:
    self: The task instance
    task_id (str): ID of the failed task
    error (str): Error message from the failed task
    traceback (str): Stack trace of the failure
    
Returns:
    bool: True if failure handling was successful
r   )send_telegram_messagezTask z	 failed: ENABLEDu&   🚨 Task Failure Alert 🚨
Task ID: z
Error: T)apps.notifications.tasksr5   r-   r   TELEGRAM_CONFIGgetdelay)r0   task_iderror	tracebackr5   s        r1   task_failure_handlerr>      sc    " ? 
E')E7
+, ##I..##y !W	
 r3   )__doc__osceleryr   django.confr   environ
setdefaultappconfig_from_objectautodiscover_tasksconftask_routestask_default_queuetask_queuesupdate	TIME_ZONEtask_annotationsworker_send_task_eventstask_send_sent_eventhasattrr*   beat_scheduletaskr2   r>    r3   r1   <module>rU      s   
    

  . @ Vn   -  B     %&9:$&89#*O"< '6	  (  (* ') $& !## 2 8 ##/  > !* !) !7 . $(   $  8+,,%::CHH tD D$ t r3   