qiskit/tools/monitor/job_monitor.py
def _text_checker(job, interval, _interval_set=False, quiet=False, output=sys.stdout):
    """A text-based job status checker

    Args:
        job (BaseJob): The job to check.
        interval (int): The interval at which to check.
        _interval_set (bool): Was interval time set by user?
        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.

    """
    status = job.status()
    msg = status.value
    prev_msg = msg
    msg_len = len(msg)

    if not quiet:
        print('\r%s: %s' % ('Job Status', msg), end='', file=output)
    while status.name not in ['DONE', 'CANCELLED', 'ERROR']:
        time.sleep(interval)
        status = job.status()
        msg = status.value

        if status.name == 'QUEUED':
            msg += ' (%s)' % job.queue_position()
            if not _interval_set:
                interval = max(job.queue_position(), 2)
        else:
            if not _interval_set:
                interval = 2

        # Adjust length of message so there are no artifacts
        if len(msg) < msg_len:
            msg += ' ' * (msg_len - len(msg))
        elif len(msg) > msg_len:
            msg_len = len(msg)

        if msg != prev_msg and not quiet:
            print('\r%s: %s' % ('Job Status', msg), end='', file=output)
            prev_msg = msg
    if not quiet:
        print('', file=output)
def _text_checker(job, interval, _interval_set=False, quiet=False, output=sys.stdout):
    status = job.status()
    msg = status.value
    prev_msg = msg
    msg_len = len(msg)

    if not quiet:
        print('\r%s: %s' % ('Job Status', msg), end='', file=output)
    while status.name not in ['DONE', 'CANCELLED', 'ERROR']:
        time.sleep(interval)
        status = job.status()
        msg = status.value

        if status.name == 'QUEUED':
            msg += ' (%s)' % job.queue_position()
            if not _interval_set:
                interval = max(job.queue_position(), 2)
        else:
            if not _interval_set:
                interval = 2

        # Adjust length of message so there are no artifacts
        if len(msg) < msg_len:
            msg += ' ' * (msg_len - len(msg))
        elif len(msg) > msg_len:
            msg_len = len(msg)

        if msg != prev_msg and not quiet:
            print('\r%s: %s' % ('Job Status', msg), end='', file=output)
            prev_msg = msg
    if not quiet:
        print('', file=output)
def _text_checker ( job , interval , _interval_set = False , quiet = False , output = sys . stdout ) : status = job . status ( ) msg = status . value prev_msg = msg msg_len = len ( msg ) if not quiet : print ( '\r%s: %s' % ( 'Job Status' , msg ) , end = '' , file = output ) while status . name not in [ 'DONE' , 'CANCELLED' , 'ERROR' ] : time . sleep ( interval ) status = job . status ( ) msg = status . value if status . name == 'QUEUED' : msg += ' (%s)' % job . queue_position ( ) if not _interval_set : interval = max ( job . queue_position ( ) , 2 ) else : if not _interval_set : interval = 2 # Adjust length of message so there are no artifacts if len ( msg ) < msg_len : msg += ' ' * ( msg_len - len ( msg ) ) elif len ( msg ) > msg_len : msg_len = len ( msg ) if msg != prev_msg and not quiet : print ( '\r%s: %s' % ( 'Job Status' , msg ) , end = '' , file = output ) prev_msg = msg if not quiet : print ( '' , file = output )
A text-based job status checker

    Args:
        job (BaseJob): The job to check.
        interval (int): The interval at which to check.
        _interval_set (bool): Was interval time set by user?
        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.
A text - based job status checker