§
    ¹³Ùg¸  ã                  ó¾   — d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZ e
rdd
lmZ  G d„ d¦  «        Z G d„ dee¦  «        ZdS )zJob abstract interface.é    )ÚannotationsN)ÚABCÚabstractmethod)ÚCallableÚOptionalÚTYPE_CHECKING)ÚQiskitError)ÚBackend)ÚJobTimeoutError)ÚJOB_FINAL_STATESÚ	JobStatus)ÚResultc                  ó   — e Zd ZdZdZdS )ÚJoba.  Base common type for all versioned Job abstract classes.

    Note this class should not be inherited from directly, it is intended
    to be used for type checking. When implementing a provider you should use
    the versioned abstract classes as the parent class and not this class
    directly.
    r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úversion© ó    úJ/granary/edev/quantum/lib/python3.11/site-packages/qiskit/providers/job.pyr   r      s   € € € € € ðð ð €G€G€Gr   r   c                  óª   — e Zd ZdZdZdZd"d
„Zd#d„Zd$d„Zd%d„Z	d%d„Z
d%d„Zd%d„Z	 d&d'd„Zed„ ¦   «         Zed(d„¦   «         Zd„ Zed)d!„¦   «         ZdS )*ÚJobV1ap  Class to handle jobs

    This first version of the Backend abstract class is written to be mostly
    backwards compatible with the legacy providers interface. This was done to ease
    the transition for users and provider maintainers to the new versioned providers. Expect,
    future versions of this abstract class to change the data model and
    interface.
    é   TÚbackendúOptional[Backend]Újob_idÚstrÚreturnÚNonec                ó0   — || _         || _        || _        dS )a  Initializes the asynchronous job.

        Args:
            backend: the backend used to run the job.
            job_id: a unique id in the context of the backend used to run
                the job.
            kwargs: Any key value metadata to associate with this job.
        N)Ú_job_idÚ_backendÚmetadata)Úselfr   r   Úkwargss       r   Ú__init__zJobV1.__init__7   s   € ð ˆŒØˆŒØˆŒˆˆr   c                ó   — | j         S )z'Return a unique id identifying the job.)r#   ©r&   s    r   r   zJobV1.job_idD   s
   € àŒ|Ðr   r
   c                ó<   — | j         €t          d¦  «        ‚| j         S )z/Return the backend where this job was executed.Nz"The job does not have any backend.)r$   r	   r*   s    r   r   zJobV1.backendH   s!   € àŒ=Ð ÝÐBÑCÔCÐCØŒ}Ðr   Úboolc                óF   — |                       ¦   «         t          j        k    S )z,Return whether the job has successfully run.)Ústatusr   ÚDONEr*   s    r   Údonez
JobV1.doneN   s   € à�{Š{‰}Œ}¥	¤Ò.Ð.r   c                óF   — |                       ¦   «         t          j        k    S )z+Return whether the job is actively running.)r.   r   ÚRUNNINGr*   s    r   ÚrunningzJobV1.runningR   s   € à�{Š{‰}Œ}¥	Ô 1Ò1Ð1r   c                óF   — |                       ¦   «         t          j        k    S )z*Return whether the job has been cancelled.)r.   r   Ú	CANCELLEDr*   s    r   Ú	cancelledzJobV1.cancelledV   s   € à�{Š{‰}Œ}¥	Ô 3Ò3Ð3r   c                ó8   — |                       ¦   «         t          v S )zMReturn whether the job is in a final job state such as ``DONE`` or ``ERROR``.)r.   r   r*   s    r   Úin_final_statezJobV1.in_final_stateZ   s   € à�{Š{‰}Œ}Õ 0Ð0Ð0r   Né   ÚtimeoutúOptional[float]ÚwaitÚfloatÚcallbackúOptional[Callable]c                ó¢  — | j         sdS t          j        ¦   «         }|                      ¦   «         }|t          vr•t          j        ¦   «         |z
  }|�+||k    r%t	          d|                      ¦   «         › d�¦  «        ‚|r ||                      ¦   «         || ¦  «         t          j        |¦  «         |                      ¦   «         }|t          v°•dS )a  Poll the job status until it progresses to a final state such as ``DONE`` or ``ERROR``.

        Args:
            timeout: Seconds to wait for the job. If ``None``, wait indefinitely.
            wait: Seconds between queries.
            callback: Callback function invoked after each query.
                The following positional arguments are provided to the callback function:

                * job_id: Job ID
                * job_status: Status of the job from the last query
                * job: This BaseJob instance

                Note: different subclass might provide different arguments to
                the callback function.

        Raises:
            JobTimeoutError: If the job does not reach a final state before the
                specified timeout.
        NzTimeout while waiting for job ú.)Ú_asyncÚtimer.   r   r   r   Úsleep)r&   r:   r<   r>   Ú
start_timer.   Úelapsed_times          r   Úwait_for_final_statezJobV1.wait_for_final_state^   sÏ   € ð, Œ{ð 	ØˆFÝ”Y‘[”[ˆ
Ø—’‘”ˆØÕ,Ð,Ð,Ýœ9™;œ;¨Ñ3ˆLØÐ" |°wÒ'>Ð'>Ý%Ð&WÀtÇ{Â{Á}Ä}Ð&WÐ&WÐ&WÑXÔXÐXØð 6Ø�˜Ÿš™œ¨°Ñ5Ô5Ð5ÝŒJ�tÑÔÐØ—[’[‘]”]ˆFð Õ,Ð,Ð,ð 	ˆr   c                ó   — dS )z,Submit the job to the backend for execution.Nr   r*   s    r   ÚsubmitzJobV1.submit‚   ó	   € ð 	ˆr   r   c                ó   — dS )zReturn the results of the job.Nr   r*   s    r   ÚresultzJobV1.result‡   rJ   r   c                ó   — t           ‚)zAttempt to cancel the job.)ÚNotImplementedErrorr*   s    r   ÚcancelzJobV1.cancelŒ   s   € å!Ð!r   r   c                ó   — dS )z@Return the status of the job, among the values of ``JobStatus``.Nr   r*   s    r   r.   zJobV1.status�   rJ   r   )r   r   r   r   r    r!   )r    r   )r    r
   )r    r,   )Nr9   N)r:   r;   r<   r=   r>   r?   r    r!   )r    r   )r    r   )r   r   r   r   r   rB   r(   r   r   r0   r3   r6   r8   rG   r   rI   rL   rO   r.   r   r   r   r   r   *   sA  € € € € € ðð ð €GØ€Fðð ð ð ðð ð ð ðð ð ð ð/ð /ð /ð /ð2ð 2ð 2ð 2ð4ð 4ð 4ð 4ð1ð 1ð 1ð 1ð
 `dð"ð "ð "ð "ð "ðH ðð ñ „^ðð ðð ð ñ „^ðð"ð "ð "ð ðð ð ñ „^ðð ð r   r   )r   Ú
__future__r   rC   Úabcr   r   Útypingr   r   r   Úqiskit.exceptionsr	   Úqiskit.providers.backendr
   Úqiskit.providers.exceptionsr   Úqiskit.providers.jobstatusr   r   Úqiskit.resultr   r   r   r   r   r   ú<module>rY      s.  ðð Ð à "Ð "Ð "Ð "Ð "Ð "à €€€Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à )Ð )Ð )Ð )Ð )Ð )Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø BÐ BÐ BÐ BÐ BÐ BÐ BÐ Bàð %Ø$Ð$Ð$Ð$Ð$Ð$ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ðið ið ið ið iˆC�ñ iô ið ið ið ir   