
    {	i                     v    S r SSKrSSKJr  SSKJrJr  SSKJrJ	r	  \R                  " \5      r " S S\5      rg)	zAThis module implements the job class used for AerBackend objects.    N)JobV1)	JobStatusJobError   )DEFAULT_EXECUTORrequires_submitc                      ^  \ rS rSrSr    SU 4S jjrS r\SS j5       r\S 5       r	\S 5       r
S rS	 rS
 rSrU =r$ )AerJob   z AerJob class for Aer Simulators.c                    > [         TU ]  X5        X0l        X@l        XPl        X`l        U=(       d    [        U l        SU l        g)a  Initializes the asynchronous job.

Args:
    backend(AerBackend): the backend used to run the job.
    job_id(str): a unique id in the context of the backend used to run the job.
    fn(function): a callable function to execute qobj on backend.
        This should usually be a bound :meth:`AerBackend._run()` method,
        with the signature `(qobj: QasmQobj, job_id: str) -> Result`.
    circuits(list of QuantumCircuit): circuits to execute.
    parameter_binds(list): parameters for circuits.
    run_options(dict): run_options to execute.
    executor(ThreadPoolExecutor):
        The executor to be used to submit the job.

Raises:
    JobError: if no qobj and no circuits.
N)	super__init___fn	_circuits_parameter_binds_run_optionsr   	_executor_future)	selfbackendjob_idfncircuitsparameter_bindsrun_optionsexecutor	__class__s	           P/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/jobs/aerjob.pyr   AerJob.__init__   s<    6 	)! /'!5%5    c                     U R                   b  [        S5      eU R                  R                  U R                  U R
                  U R                  U R                  U R                  5      U l         g)zSubmit the job to the backend for execution.

Raises:
    QobjValidationError: if the JSON serialization of the Qobj passed
    during construction does not validate against the Qobj schema.
    JobError: if trying to re-submit the job.
Nz#Aer job has already been submitted.)	r   r   r   submitr   r   r   r   _job_idr   s    r   r"   AerJob.submit@   sV     <<#@AA~~,,HHdnnd&;&;T=N=NPTP\P\
r    c                 4    U R                   R                  US9$ )a  Get job result. The behavior is the same as the underlying
concurrent Future objects,

https://docs.python.org/3/library/concurrent.futures.html#future-objects

Args:
    timeout (float): number of seconds to wait for results.

Returns:
    qiskit.Result: Result object

Raises:
    concurrent.futures.TimeoutError: if timeout occurred.
    concurrent.futures.CancelledError: if job cancelled before completed.
)timeout)r   result)r   r'   s     r   r(   AerJob.resultN   s    $ ||""7"33r    c                 6    U R                   R                  5       $ )zAttempt to cancel the job.)r   cancelr$   s    r   r+   AerJob.cancelb   s     ||""$$r    c                    U R                   R                  5       (       a  [        R                  nU$ U R                   R	                  5       (       a  [        R
                  nU$ U R                   R                  5       (       a?  U R                   R                  5       c  [        R                  nU$ [        R                  nU$ [        R                  nU$ )zGets the status of the job by querying the Python's future

Returns:
    JobStatus: The current JobStatus

Raises:
    JobError: If the future is in unexpected state
    concurrent.futures.TimeoutError: if timeout occurred.
)r   runningr   RUNNING	cancelled	CANCELLEDdone	exceptionDONEERRORINITIALIZING)r   _statuss     r   statusAerJob.statusg   s     <<!!''G  \\##%%))G  \\  (,(>(>(@(HinnG  OXooG   ,,Gr    c                     U R                   $ )z5Return the instance of the backend used for this job.)_backendr$   s    r   r   AerJob.backend   s    }}r    c                     U R                   $ )zReturn the list of QuantumCircuit submitted for this job.

Returns:
    list of QuantumCircuit: the list of QuantumCircuit submitted for this job.
)r   r$   s    r   r   AerJob.circuits   s     ~~r    c                     U R                   $ )z Return the executor for this job)r   r$   s    r   r   AerJob.executor   s    ~~r    )r   r   r   r   r   r   )NNNN)N)__name__
__module____qualname____firstlineno____doc__r   r"   r   r(   r+   r8   r   r   r   __static_attributes____classcell__)r   s   @r   r
   r
      so    * !F
 4 4& % %  2 r    r
   )rE   loggingqiskit.providersr   Jobr   r   utilsr   r   	getLoggerrA   LOGGERr
    r    r   <module>rO      s5    H  ) 0 4			8	$uS ur    