3
$\begingroup$

I can see in example code of qiskit, to implement job monitors on IBM Quantum machines, example uses any of the following

from qiskit.tools.monitor import job_monitor
from qiskit.providers.ibmq.job import job_monitor

I have downloaded qiskit in my laptop and used both of them. Could not see any differences.

What is the difference between them? Does the invocation vary depending on the Quantum machine on which job is being executed?

$\endgroup$
1
$\begingroup$

They both are (almost) identical: https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html

The only difference is that qiskit.tools.monitor.job_monitor() have a argument named quiet, which is set to false by default:

job_monitor(job, interval=None, quiet=False, output=sys.stdout)

If we set to to true, it will not print any status message.

As a best practice, you can use help() function.

If we import the first version:

from qiskit.tools.monitor import job_monitor
help(job_monitor)

Corrosponding output shows:

Help on function job_monitor in module qiskit.tools.monitor.job_monitor:

job_monitor(job, interval=None, quiet=False, output=<ipykernel.iostream.OutStream object at 0x7fa9383ff7c0>)
    Monitor the status of a IBMQJob instance.

    Args:
        job (BaseJob): Job to monitor.
        interval (int): Time interval between status queries.
        quiet (bool): If True, do not print status messages.
        output (file): The file like object to write status messages to.
        By default this is sys.stdout.

Now, if we import the second version:

from qiskit.providers.ibmq.job import job_monitor
help(job_monitor)

Corrosponding output shows:

Help on function job_monitor in module qiskit.providers.ibmq.job.job_monitor:

job_monitor(job: qiskit.providers.ibmq.job.ibmqjob.IBMQJob, interval: Union[float, NoneType] = None, output: <class 'TextIO'> = <ipykernel.iostream.OutStream object at 0x7fa9383ff7c0>) -> None
    Monitor the status of an ``IBMQJob`` instance.

    Args:
        job: Job to monitor.
        interval: Time interval between status queries.
        output: The file like object to write status messages to.
            By default this is sys.stdout.
$\endgroup$
2
1
$\begingroup$

briefly, no big difference.

you can see the difference from the source code (the links below or the source code from your installed places such as anaconda3\envs[qiskit_envs_name]\Lib\site-packages\qiskit)

ibmq version: https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html

tools version: https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html

for detail, the ibmq version has a little bit more info, such as queue_info and RUNNING status, and the tools version has a quiet parameter to control the print out messages

$\endgroup$
1
$\begingroup$

They are different depending on the qiskit version.

Check qiskit version using: qiskit.qiskit_version

I have installed latest qiskit which gives: {'qiskit-terra': '0.14.2', 'qiskit-aer': '0.5.2', 'qiskit-ignis': '0.3.3', 'qiskit-ibmq-provider': '0.7.2', 'qiskit-aqua': '0.7.3', 'qiskit': '0.19.6'}

Check your respective version.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.