+
    jHàj{  ã                  ó¸   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ]P                  ! ]4      t/ tR]R&   RR/R	 R
 llt ! R R4      tR# )a…  Liveness side of a running cron job: the inactivity watchdog loop and the execution-ledger
progress stamps.

Both read the same signal (the agent's idle time) and act on opposite edges of it. The
watchdog interrupts the run once idle time crosses the configured limit. The stamper refreshes
``progress_at`` while idle time stays short, so the live-owner stale-claim sweep (#115692)
measures silence since the last stamp rather than run length: a busy multi-hour job keeps
stamping and is never reclaimed under a healthy owner, while a wedged worker reports growing
idle time, stops stamping, and is still released once the derived bound passes.
)ÚannotationsN)ÚCallableÚOptional)ÚAwakeIdleMeter)Útouch_execution_progresszdict[str, float]Úowner_progressÚmeterc               ó4   € V ^8„  d   QhRRRRRRRRRR	R
RRR/# )é   Úget_idle_secondsúCallable[[], float]Úlimit_sÚfloatÚpoll_sÚstopzthreading.EventÚfuture_donezCallable[[], bool]r   zOptional[AwakeIdleMeter]ÚreturnÚbool© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/cron/scheduler_liveness.pyÚ__annotate__r      sF   € ÷ ñ Ø,ðØ7<ðØFKðØSbðà#ðà,Dðð 
ñó    c                óþ   € Vf   \        4       pVP                  V4      '       gE   V! 4       '       d   R#  \        V ! 4       ;'       g    R4      pVP	                  V4      V8¼  g   KY  R# R#   \         d    Rp L+i ; i)uê  Poll idle time until limit (-> True), stop, or the future completes (-> False). Uses
``threading.Event.wait``, not asyncio, so a blocked event loop cannot disable the watchdog.

Driven by ``threading.Event.wait`` (a kernel timeout), not asyncio, so a blocked event-loop /
``run_job`` thread cannot disable this watchdog the way ``asyncio.sleep`` / ``wait_for`` would (family A
of #94285 â€” the 4118s-idle-on-a-600s-limit cron hang). Returns True when *limit_s* of inactivity was
observed.
Fg        T)r   Úwaitr   Ú	ExceptionÚmeasure)r   r   r   r   r   r   Úidles   $$$$$$ r   Ú_inactivity_watchdog_loopr      st   € ð ‚}ÜÓ ˆØ�i‰i˜×ÒÙ�=Š=Ùð	ÜÑ)Ó+×2Ð2¨sÓ3ˆDð �=‰=˜Ó 'Ö)ÙÙøô	 ô 	ØŠDð	ús   ¶A, Á	A, Á,A<Á;A<c                  ó.   € ] tR t^9tR R ltR R ltRtR# )ÚExecutionProgressStamperc               ó(   € V ^8„  d   QhRRRRRRRR/# )r
   Úexecution_idÚstrÚjob_nameÚidle_secondsr   Úevery_secondsr   r   )r   s   "r   r   Ú%ExecutionProgressStamper.__annotate__:   s,   € ÷ &ñ &Øð&Ø+.ð&ØATð&àñ&r   c               	ój   € Wn         W n        W0n        W@n        \        P
                  ! 4       V n        R # )N)Ú_execution_idÚ	_job_nameÚ_idle_secondsÚ_everyÚtimeÚ	monotonicÚ_last)Úselfr"   r$   r%   r&   s   &&&$$r   Ú__init__Ú!ExecutionProgressStamper.__init__:   s(   € ð *ÔØ!ŒØ)ÔØ#ŒÜ—^’^Ó%ˆŽ
r   c               ó   € V ^8„  d   QhRR/# )r
   r   ÚNoner   )r   s   "r   r   r'   D   s   € ÷ eñ e�dñ er   c                	óÌ  € V P                   '       g   R # \        P                  ! 4       pWP                  ,
          V P                  8  d   R # V P                  4       V P                  8¼  d   R # Wn        \        P                  ! 4       \        V P                   &    \        V P                   4       R #   \         d'    \        P                  RT P                  RR7        R # i ; i)Nz)Job '%s': execution progress stamp failedT)Úexc_info)r)   r-   r.   r/   r,   r+   r   r   r   ÚloggerÚdebugr*   )r0   Únows   & r   ÚtickÚExecutionProgressStamper.tickD   s¥   € Ø×!×!Ð!ÙÜ�nŠnÓˆØ—‘Õ˜dŸk™kÔ)Ùð ×ÑÓ 4§;¡;Ô.ÙØŒ
Ü-1¯YªY«[Œ�t×)Ñ)Ñ*ð	eÜ$ T×%7Ñ%7Ö8øÜô 	eÜ�L‰LÐDÀdÇnÁnÐ_cˆL×dð	eús   ÂB2 Â2-C#Ã"C#)r,   r)   r+   r*   r/   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r1   r:   Ú__static_attributes__r   r   r   r    r    9   s   † õ&÷eñ er   r    )Ú__conditional_annotations__Ú__doc__Ú
__future__r   ÚloggingÚ	threadingr-   Útypingr   r   Úagent.session_activityr   Úcron.executionsr   Ú	getLoggerr<   r7   r   Ú__annotations__r   r    )rA   s   @r   Ú<module>rK      sX   øðô	õ #ã Û Û ß %å 1Ý 4à	×	Ò	˜8Ó	$€ð
 $&€Ð Ó %ðàGK÷÷6eó er   