Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return [str(docker_image)]
text_markup = [docker_image.short_id]
if docker_image.names:
text_markup.append(" ")
text_markup.append(("main_list_lg", docker_image.names[0].to_str()))
c = docker_image.container_command or docker_image.comment
if c:
text_markup.append(" ")
text_markup.append(("main_list_ddg", c))
if with_size:
text_markup.append(" ")
text_markup.append(("main_list_ddg", "(%s)" % humanize_bytes(docker_image.total_size)))
return text_markup
[SelectableText("Id", maps=get_map("main_list_green")),
SelectableText(self.docker_image.image_id)],
[SelectableText("Created", maps=get_map("main_list_green")),
SelectableText("{0}, {1}".format(self.docker_image.display_formal_time_created(),
self.docker_image.display_time_created()))],
[SelectableText("Size", maps=get_map("main_list_green")),
SelectableText(humanize_bytes(self.docker_image.total_size))],
]
if self.docker_image.unique_size:
data.append(
[SelectableText("Unique Size", maps=get_map("main_list_green")),
SelectableText(humanize_bytes(self.docker_image.unique_size))])
if self.docker_image.shared_size:
data.append(
[SelectableText("Shared Size", maps=get_map("main_list_green")),
SelectableText(humanize_bytes(self.docker_image.shared_size))])
data.append([SelectableText("Command", maps=get_map("main_list_green")),
SelectableText(self.docker_image.container_command)])
self.walker.extend(assemble_rows(data, ignore_columns=[1]))
mem_current = humanize_bytes(update["mem_current"])
mem_value.text = "%.2f %% (%s)" % (mem_percent, mem_current)
mem_g.rotate_value(int(mem_percent), max_val=100)
blk_read = update["blk_read"]
blk_write = update["blk_write"]
blk_r_value.text = humanize_bytes(blk_read)
blk_w_value.text = humanize_bytes(blk_write)
r_max_val = blk_r_g.rotate_value(blk_read, adaptive_max=True)
w_max_val = blk_w_g.rotate_value(blk_write, adaptive_max=True)
blk_r_g.set_max(max((r_max_val, w_max_val)))
blk_w_g.set_max(max((r_max_val, w_max_val)))
net_read = update["net_rx"]
net_write = update["net_tx"]
net_r_value.text = humanize_bytes(net_read)
net_w_value.text = humanize_bytes(net_write)
r_max_val = net_r_g.rotate_value(net_read, adaptive_max=True)
w_max_val = net_w_g.rotate_value(net_write, adaptive_max=True)
net_r_g.set_max(max((r_max_val, w_max_val)))
net_w_g.set_max(max((r_max_val, w_max_val)))
if self.stop.is_set():
break
logger.debug(update)
cpu_percent = update["cpu_percent"]
cpu_value.text = "%.2f %%" % cpu_percent
cpu_g.rotate_value(int(cpu_percent), max_val=100)
mem_percent = update["mem_percent"]
mem_current = humanize_bytes(update["mem_current"])
mem_value.text = "%.2f %% (%s)" % (mem_percent, mem_current)
mem_g.rotate_value(int(mem_percent), max_val=100)
blk_read = update["blk_read"]
blk_write = update["blk_write"]
blk_r_value.text = humanize_bytes(blk_read)
blk_w_value.text = humanize_bytes(blk_write)
r_max_val = blk_r_g.rotate_value(blk_read, adaptive_max=True)
w_max_val = blk_w_g.rotate_value(blk_write, adaptive_max=True)
blk_r_g.set_max(max((r_max_val, w_max_val)))
blk_w_g.set_max(max((r_max_val, w_max_val)))
net_read = update["net_rx"]
net_write = update["net_tx"]
net_r_value.text = humanize_bytes(net_read)
net_w_value.text = humanize_bytes(net_write)
r_max_val = net_r_g.rotate_value(net_read, adaptive_max=True)
w_max_val = net_w_g.rotate_value(net_write, adaptive_max=True)
net_r_g.set_max(max((r_max_val, w_max_val)))
net_w_g.set_max(max((r_max_val, w_max_val)))
g = self.docker_container.stats().response
continue
logger.error("error while getting stats: %r", ex)
self.ui.notify_message("Error while getting stats: %s" % ex, level="error")
# TODO: if debug raise
break
if self.stop.is_set():
break
logger.debug(update)
cpu_percent = update["cpu_percent"]
cpu_value.text = "%.2f %%" % cpu_percent
cpu_g.rotate_value(int(cpu_percent), max_val=100)
mem_percent = update["mem_percent"]
mem_current = humanize_bytes(update["mem_current"])
mem_value.text = "%.2f %% (%s)" % (mem_percent, mem_current)
mem_g.rotate_value(int(mem_percent), max_val=100)
blk_read = update["blk_read"]
blk_write = update["blk_write"]
blk_r_value.text = humanize_bytes(blk_read)
blk_w_value.text = humanize_bytes(blk_write)
r_max_val = blk_r_g.rotate_value(blk_read, adaptive_max=True)
w_max_val = blk_w_g.rotate_value(blk_write, adaptive_max=True)
blk_r_g.set_max(max((r_max_val, w_max_val)))
blk_w_g.set_max(max((r_max_val, w_max_val)))
net_read = update["net_rx"]
net_write = update["net_tx"]
net_r_value.text = humanize_bytes(net_read)
net_w_value.text = humanize_bytes(net_write)
SelectableText(self.docker_container.command)],
]
# TODO: add exit code, created, started, finished, pid
if self.docker_container.names:
data.append(
[SelectableText("Name", maps=get_map("main_list_green")),
SelectableText("".join(self.docker_container.names))],
)
data.append(
[SelectableText("FS-type", maps=get_map("main_list_white")),
SelectableText("size", maps=get_map("main_list_white"))])
data.append(
[SelectableText("root"), SelectableText(humanize_bytes(self.docker_container.size_root_fs))])
data.append(
[SelectableText("rw"), SelectableText(humanize_bytes(self.docker_container.size_rw_fs))])
self.view_widgets.extend(assemble_rows(data, ignore_columns=[1]))
if self.stop.is_set():
break
logger.debug(update)
cpu_percent = update["cpu_percent"]
cpu_value.text = "%.2f %%" % cpu_percent
cpu_g.rotate_value(int(cpu_percent), max_val=100)
mem_percent = update["mem_percent"]
mem_current = humanize_bytes(update["mem_current"])
mem_value.text = "%.2f %% (%s)" % (mem_percent, mem_current)
mem_g.rotate_value(int(mem_percent), max_val=100)
blk_read = update["blk_read"]
blk_write = update["blk_write"]
blk_r_value.text = humanize_bytes(blk_read)
blk_w_value.text = humanize_bytes(blk_write)
r_max_val = blk_r_g.rotate_value(blk_read, adaptive_max=True)
w_max_val = blk_w_g.rotate_value(blk_write, adaptive_max=True)
blk_r_g.set_max(max((r_max_val, w_max_val)))
blk_w_g.set_max(max((r_max_val, w_max_val)))
net_read = update["net_rx"]
net_write = update["net_tx"]
net_r_value.text = humanize_bytes(net_read)
net_w_value.text = humanize_bytes(net_write)
r_max_val = net_r_g.rotate_value(net_read, adaptive_max=True)
w_max_val = net_w_g.rotate_value(net_write, adaptive_max=True)
net_r_g.set_max(max((r_max_val, w_max_val)))
net_w_g.set_max(max((r_max_val, w_max_val)))