def update(self, messages): with log_errors(): msg = messages['progress'] if not msg: return nb = nbytes_bar(msg['nbytes']) self.source.data.update(nb) self.root.title.text = \ "Memory Use: %0.2f MB" % (sum(msg['nbytes'].values()) / 1e6)
def update(self, messages): with log_errors(): msg = messages["progress"] if not msg: return nb = nbytes_bar(msg["nbytes"]) update(self.source, nb) self.root.title.text = "Memory Use: %0.2f MB" % ( sum(msg["nbytes"].values()) / 1e6)
def update(self, messages): with log_errors(): msg = messages['progress'] if not msg: return nb = nbytes_bar(msg['nbytes']) self.source.data.update(nb) self.root.title.text = \ "Memory Use: %0.2f MB" % (sum(msg['nbytes'].values()) / 1e6)
def test_nbytes_bar(): nbytes = {'inc': 1000, 'dec': 3000} expected = {'name': ['dec', 'inc'], 'left': [0, 0.75], 'center': [0.375, 0.875], 'right': [0.75, 1.0], 'percent': [75, 25], 'MB': [0.003, 0.001], 'text': ['dec', 'inc']} result = nbytes_bar(nbytes) color = result.pop('color') assert len(set(color)) == 2 assert result == expected
def progress_update(): with log_errors(): msg = messages['progress'] d = progress_quads(msg) progress_source.data.update(d) progress_plot.title.text = ("Progress -- total: %(total)s, " "in-memory: %(in-memory)s, processing: %(processing)s, " "ready: %(ready)s, waiting: %(waiting)s, failed: %(failed)s" % messages['tasks']['deque'][-1]) nb = nbytes_bar(msg['nbytes']) nbytes_task_source.data.update(nb) nbytes_task_plot.title.text = \ "Memory Use: %0.2f MB" % (sum(msg['nbytes'].values()) / 1e6)
def test_nbytes_bar(): nbytes = {'inc': 1000, 'dec': 3000} expected = {'name': ['dec', 'inc'], 'left': [0, 0.75], 'center': [0.375, 0.875], 'right': [0.75, 1.0], 'percent': [75, 25], 'MB': [0.003, 0.001], 'text': ['dec', 'inc']} result = nbytes_bar(nbytes) color = result.pop('color') assert len(set(color)) == 2 assert result == expected
def progress_update(): with log_errors(): msg = messages['progress'] d = progress_quads(msg) progress_source.data.update(d) progress_plot.title.text = ( "Progress -- total: %(total)s, " "in-memory: %(in-memory)s, processing: %(processing)s, " "ready: %(ready)s, waiting: %(waiting)s, failed: %(failed)s" % messages['tasks']['deque'][-1]) nb = nbytes_bar(msg['nbytes']) nbytes_task_source.data.update(nb) nbytes_task_plot.title.text = \ "Memory Use: %0.2f MB" % (sum(msg['nbytes'].values()) / 1e6)
def test_nbytes_bar(): nbytes = {"inc": 1000, "dec": 3000} expected = { "name": ["dec", "inc"], "left": [0, 0.75], "center": [0.375, 0.875], "right": [0.75, 1.0], "percent": [75, 25], "MB": [0.003, 0.001], "text": ["dec", "inc"], } result = nbytes_bar(nbytes) color = result.pop("color") assert len(set(color)) == 2 assert result == expected