
    mjR                     H    d dl mZm Z mZ d dlmZ d dlmZmZ d dlm	Z	 ddZ
y)    )UTCdatetime	timedelta)
app_config)AgentRegistrationRemoteEvent)WatcherNc                 x   t        t        | dz        |       }t        ddddddd      }t        d	|d
ddt	        dddddt
              ddd      }	 |j                  |      }|j                  |      }|d   r|d   rJ |d   sJ |j                  j                  d      j                         d   dk(  sJ |j                  j                  d      j                         d   dk(  sJ |j                  j                         d   }|d   d
k(  sJ |d   dk(  sJ |d   dk(  sJ |j                  j                  t	        j                  t
              t        d      z   d       |j                  j                         d   }|d    d!k(  sJ |d"   d!k(  sJ 	 |j                          y # |j                          w xY w)#Nzremote.sqlitezagent.remote.carloCarloz0.1vpscarlopython)	heartbeat
run_eventszevent-1zworker.carlo.transcriptzyoutube.transcript.batchr   i           r   )tzinfo
Transcript<   )display_namestale_after_secondsaccepted	duplicatez%SELECT COUNT(*) FROM execution_agentsz"SELECT COUNT(*) FROM remote_events
worker_keylocation_typehost   )secondsx   observation_statusstalehealth_status)r	   r   r   r   r   r   ingest_remote_event
connectionexecutefetchone
repositorystatus_rowsrefresh_remote_stalenessnowr   close)tmp_pathwatcheragenteventfirstsecondrow	stale_rows           'tests/integration/test_remote_ingest.py>test_remote_worker_registers_and_duplicate_event_is_idempotentr6      s   jO!;<hGG2GUE7T\^yzE	5*CE_al q!R3?R^wyAz|E++E2,,U3Z {);;;k"""!!))*QR[[]^_`deeee!!))*NOXXZ[\]abbbb  ,,.q1< $====?#u,,,6{g%%%33HLL4E	Z]H^4^`cd&&224Q7	-.'999)W444s   EF' 'F9)returnN)r   r   r   tests.conftestr   worker_watcher.modelsr   r   worker_watcher.watcherr	   r6        r5   <module>r=      s    - - % @ *r<   