qiskit/tools/jupyter/backend_overview.py
def update_backend_info(self, interval=60):
    """Updates the monitor info
    Called from another thread.
    """
    my_thread = threading.currentThread()
    current_interval = 0
    started = False
    all_dead = False
    stati = [None]*len(self._backends)
    while getattr(my_thread, "do_run", True) and not all_dead:
        if current_interval == interval or started is False:
            for ind, back in enumerate(self._backends):
                _value = self.children[ind].children[2].value
                _head = _value.split('<b>')[0]
                try:
                    _status = back.status()
                    stati[ind] = _status
                except Exception:  # pylint: disable=W0703
                    self.children[ind].children[2].value = _value.replace(
                        _head, "<h5 style='color:#ff5c49'>")
                    self.children[ind]._is_alive = False
                else:
                    self.children[ind]._is_alive = True
                    self.children[ind].children[2].value = _value.replace(
                        _head, "<h5>")

            idx = list(range(len(self._backends)))
            pending = [s.pending_jobs for s in stati]
            _, least_idx = zip(*sorted(zip(pending, idx)))

            # Make sure least pending is operational
            for ind in least_idx:
                if stati[ind].operational:
                    least_pending_idx = ind
                    break

            for var in idx:
                if var == least_pending_idx:
                    self.children[var].children[4].value = "<h5 style='color:#34bc6e'>True</h5>"
                else:
                    self.children[var].children[4].value = "<h5 style='color:#dc267f'>False</h5>"

                self.children[var].children[3].children[1].value = pending[var]
                self.children[var].children[3].children[1].max = max(
                    self.children[var].children[3].children[1].max, pending[var]+10)
                if stati[var].operational:
                    self.children[var].children[5].value = "<h5 style='color:#34bc6e'>True</h5>"
                else:
                    self.children[var].children[5].value = "<h5 style='color:#dc267f'>False</h5>"

            started = True
            current_interval = 0
        time.sleep(1)
        all_dead = not any([wid._is_alive for wid in self.children])
        current_interval += 1
def update_backend_info(self, interval=60):
    my_thread = threading.currentThread()
    current_interval = 0
    started = False
    all_dead = False
    stati = [None]*len(self._backends)
    while getattr(my_thread, "do_run", True) and not all_dead:
        if current_interval == interval or started is False:
            for ind, back in enumerate(self._backends):
                _value = self.children[ind].children[2].value
                _head = _value.split('<b>')[0]
                try:
                    _status = back.status()
                    stati[ind] = _status
                except Exception:  # pylint: disable=W0703
                    self.children[ind].children[2].value = _value.replace(
                        _head, "<h5 style='color:#ff5c49'>")
                    self.children[ind]._is_alive = False
                else:
                    self.children[ind]._is_alive = True
                    self.children[ind].children[2].value = _value.replace(
                        _head, "<h5>")

            idx = list(range(len(self._backends)))
            pending = [s.pending_jobs for s in stati]
            _, least_idx = zip(*sorted(zip(pending, idx)))

            # Make sure least pending is operational
            for ind in least_idx:
                if stati[ind].operational:
                    least_pending_idx = ind
                    break

            for var in idx:
                if var == least_pending_idx:
                    self.children[var].children[4].value = "<h5 style='color:#34bc6e'>True</h5>"
                else:
                    self.children[var].children[4].value = "<h5 style='color:#dc267f'>False</h5>"

                self.children[var].children[3].children[1].value = pending[var]
                self.children[var].children[3].children[1].max = max(
                    self.children[var].children[3].children[1].max, pending[var]+10)
                if stati[var].operational:
                    self.children[var].children[5].value = "<h5 style='color:#34bc6e'>True</h5>"
                else:
                    self.children[var].children[5].value = "<h5 style='color:#dc267f'>False</h5>"

            started = True
            current_interval = 0
        time.sleep(1)
        all_dead = not any([wid._is_alive for wid in self.children])
        current_interval += 1
def update_backend_info ( self , interval = 60 ) : my_thread = threading . currentThread ( ) current_interval = 0 started = False all_dead = False stati = [ None ] * len ( self . _backends ) while getattr ( my_thread , "do_run" , True ) and not all_dead : if current_interval == interval or started is False : for ind , back in enumerate ( self . _backends ) : _value = self . children [ ind ] . children [ 2 ] . value _head = _value . split ( '<b>' ) [ 0 ] try : _status = back . status ( ) stati [ ind ] = _status except Exception : # pylint: disable=W0703 self . children [ ind ] . children [ 2 ] . value = _value . replace ( _head , "<h5 style='color:#ff5c49'>" ) self . children [ ind ] . _is_alive = False else : self . children [ ind ] . _is_alive = True self . children [ ind ] . children [ 2 ] . value = _value . replace ( _head , "<h5>" ) idx = list ( range ( len ( self . _backends ) ) ) pending = [ s . pending_jobs for s in stati ] _ , least_idx = zip ( * sorted ( zip ( pending , idx ) ) ) # Make sure least pending is operational for ind in least_idx : if stati [ ind ] . operational : least_pending_idx = ind break for var in idx : if var == least_pending_idx : self . children [ var ] . children [ 4 ] . value = "<h5 style='color:#34bc6e'>True</h5>" else : self . children [ var ] . children [ 4 ] . value = "<h5 style='color:#dc267f'>False</h5>" self . children [ var ] . children [ 3 ] . children [ 1 ] . value = pending [ var ] self . children [ var ] . children [ 3 ] . children [ 1 ] . max = max ( self . children [ var ] . children [ 3 ] . children [ 1 ] . max , pending [ var ] + 10 ) if stati [ var ] . operational : self . children [ var ] . children [ 5 ] . value = "<h5 style='color:#34bc6e'>True</h5>" else : self . children [ var ] . children [ 5 ] . value = "<h5 style='color:#dc267f'>False</h5>" started = True current_interval = 0 time . sleep ( 1 ) all_dead = not any ( [ wid . _is_alive for wid in self . children ] ) current_interval += 1
Updates the monitor info
    Called from another thread.
Updates the monitor info Called from another thread .