minitrino.cmd.resources module#

Resource management commands for Minitrino CLI.

minitrino.cmd.resources.render_table(rows: list[list[Any]] | None, headers: list[str])[source][source]#

Render a table of resources.

Parameters:
  • rows (list[list[Any]]) – Data rows to be rendered.

  • headers (list[str]) – Table column headers.

Returns:

Rendered table string and the length of its longest line.

Return type:

tuple[str, int]

minitrino.cmd.resources.format_bytes(val: int | float)[source][source]#

Format bytes as a human-readable string.

Parameters:

val (int or float)

Returns:

Human-readable memory string or ‘N/A’.

Return type:

str

minitrino.cmd.resources.format_cpus(nanos: int)[source][source]#

Convert CPU units to a readable format.

Parameters:

nanos (int)

Returns:

CPU usage as a percentage string or ‘N/A’.

Return type:

str

minitrino.cmd.resources.color_status(status: str)[source][source]#

Apply color to status text.

Parameters:

status (str) – Container status (e.g., ‘running’, ‘exited’).

Returns:

Colorized status string.

Return type:

str

minitrino.cmd.resources.get_container_stats(container: MinitrinoContainer) dict[source][source]#

Fetch memory and CPU usage statistics for a container.

Parameters:

container (MinitrinoContainer)

Returns:

Dictionary with keys ‘memory’ and ‘cpu’ representing usage stats.

Return type:

dict