
    i3
                        % S SK Jr  S SKrS SKrS SKJrJr  S SKJrJ	r	  S SK
JrJrJr  S SKJr  S SKJr  S SKJrJr  S S	KJr   " S
 S5      r\" 5       rS\S'    " S S5      rg)    )annotationsN)AsyncGeneratorCallable)Event	StopEvent)PluginSnapshottableRuntimeWorkflowRuntime)StepWorkerFunction)WorkflowTick)PR)Workflowc                  8    \ rS rSr        SS jrSS jrSrg)BasicRuntime   c                    g N )selfworkflowworkflow_functionstepss       Q/home/james-whalen/.local/lib/python3.13/site-packages/workflows/plugins/basic.pyregisterBasicRuntime.register   s     	    c                    [        U5      nU$ r   )AsyncioWorkflowRuntime)r   run_idsnapshottables      r   new_runtimeBasicRuntime.new_runtime   s    .DV.Lr   r   N)r   r   r   Callable[P, R]r   z dict[str, StepWorkerFunction[R]]returnNone)r    strr%   r
   )__name__
__module____qualname____firstlineno__r   r"   __static_attributes__r   r   r   r   r      s2     * 0	
 
r   r   r   basic_runtimec                      \ rS rSrSr    SS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jr      SS
 jr    SS jrSS jrSS jrSS jrSrg)r   #   z
A plugin interface to switch out a broker runtime (external library or service that manages durable/distributed step execution)
c                    Xl         [        R                  " 5       U l        [        R                  " 5       U l        / U l        g r   )r    asyncioQueuereceive_queuepublish_queueticks)r   r    s     r   __init__AsyncioWorkflowRuntime.__init__(   s,     :A--/3:==?)+
r   c                :    U R                   R                  U5        g r   )r5   appendr   ticks     r   on_tickAsyncioWorkflowRuntime.on_tick1   s    

$r   c                    U R                   $ r   )r5   r   s    r   replayAsyncioWorkflowRuntime.replay4   s    zzr   c                R   #    U R                   R                  5       I S h  vN $  N7fr   )r3   getr?   s    r   wait_receive#AsyncioWorkflowRuntime.wait_receive7   s      ''++----s   '%'c                B   #    U R                   R                  U5        g 7fr   )r4   
put_nowait)r   events     r   write_to_event_stream,AsyncioWorkflowRuntime.write_to_event_stream:   s     %%e,   c                  #     U R                   R                  5       I S h  vN nU7v   [        U[        5      (       a  g M?   N!7fr   )r4   rC   
isinstancer   )r   items     r   stream_published_events.AsyncioWorkflowRuntime.stream_published_events=   s<     ++//11DJ$	**	 1s   AA"Ac                B   #    U R                   R                  U5        g 7fr   )r3   rG   r:   s     r   
send_event!AsyncioWorkflowRuntime.send_eventD   s     %%d+rK   c                   #    U$ 7fr   r   )r   	step_namestep_workers      r   register_step_worker+AsyncioWorkflowRuntime.register_step_workerG   s         c                   #    U$ 7fr   r   )r   r   s     r   register_workflow_function1AsyncioWorkflowRuntime.register_workflow_functionL   s      ! rY   c                4   #    [         R                  " 5       $ 7fr   )time	monotonicr?   s    r   get_nowAsyncioWorkflowRuntime.get_nowQ   s     ~~s   c                L   #    [         R                  " U5      I S h  vN   g  N7fr   )r1   sleep)r   secondss     r   rc   AsyncioWorkflowRuntime.sleepT   s     mmG$$$s   $"$c                   #    g 7fr   r   r?   s    r   closeAsyncioWorkflowRuntime.closeW   s     s   )r4   r3   r    r5   N)r    r'   r%   r&   )r;   r   r%   r&   )r%   zlist[WorkflowTick])r%   r   )rH   r   r%   r&   )r%   zAsyncGenerator[Event, None])rU   r'   rV   StepWorkerFunction[R]r%   ri   )r   r$   r%   r$   )r%   float)rd   rj   r%   r&   )r%   r&   )r(   r)   r*   r+   __doc__r6   r<   r@   rD   rI   rO   rR   rW   r[   r`   rc   rg   r,   r   r   r   r   r   #   s}    ,, 
, .-,+@	
!!/!	!
 %r   r   )
__future__r   r1   r^   typingr   r   workflows.eventsr   r   workflows.runtime.types.pluginr   r	   r
   %workflows.runtime.types.step_functionr   workflows.runtime.types.ticksr   workflows.decoratorsr   r   workflows.workflowr   r   r-   __annotations__r   r   r   r   <module>ru      sJ    #   + - X X D 6 % '  %v &5 5r   