Commit 375969eb authored by Iustin Pop's avatar Iustin Pop

htools: add human-readable output to hspace

Currently, hspace can only output a machine-readable format that
(while detailed) is hard to parse quickly by people. This patch adds
(and enables by default) a human-readable output that shows the most
important metrics in a simple format.

Most of the work of the patch is in moving the display of various
metrics from the 'main' function to separate functions, each of which
can output either a machine or human intended format.

The patch also corrects a bug in the CPU efficiency display: before,
the efficiency was computed as instance virtual CPUs divided by total
physical CPUs, which is almost always supra-unitary. More correct is
to divide by the total virtual CPUs, which shows a more meaningful
number (when the p-to-v CPU ratio has been defined correctly).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 6a5e7dbe
This diff is collapsed.
......@@ -10,7 +10,7 @@ SYNOPSIS
--------
**hspace** {backend options...} [algorithm options...] [request options...]
[ -p [*fields*] ] [-v... | -q]
[output options...] [-v... | -q]
**hspace** --version
......@@ -35,6 +35,11 @@ Request options:
**[--vcpus** *vcpus* **]**
**[--tiered-alloc** *spec* **]**
Output options:
**[--machine-readable**[=*CHOICE*] **]**
**[-p**[*fields*]**]**
DESCRIPTION
-----------
......@@ -48,19 +53,22 @@ cluster, until the point where we don't have any N+1 possible
allocation. It uses the exact same allocation algorithm as the hail
iallocator plugin in *allocate* mode.
The output of the program is designed to interpreted as a shell
fragment (or parsed as a *key=value* file). Options which extend the
output (e.g. -p, -v) will output the additional information on stderr
(such that the stdout is still parseable).
The output of the program is designed either for human consumption (the
default) or, when enabled with the ``--machine-readable`` option
(described further below), for machine consumption. In the latter case,
it is intended to interpreted as a shell fragment (or parsed as a
*key=value* file). Options which extend the output (e.g. -p, -v) will
output the additional information on stderr (such that the stdout is
still parseable).
The following keys are available in the output of the script (all
prefixed with *HTS_*):
The following keys are available in the machine-readable output of the
script (all prefixed with *HTS_*):
SPEC_MEM, SPEC_DSK, SPEC_CPU, SPEC_RQN, SPEC_DISK_TEMPLATE
These represent the specifications of the instance model used for
allocation (the memory, disk, cpu, requested nodes, disk template).
TSPEC_INI_MEM, TSPEC_INI_DSK, TSPEC_INI_CPU
TSPEC_INI_MEM, TSPEC_INI_DSK, TSPEC_INI_CPU, ...
Only defined when the tiered mode allocation is enabled, these are
similar to the above specifications but show the initial starting spec
for tiered allocation.
......@@ -185,6 +193,9 @@ If the tiered allocation mode is enabled, then many of the INI_/FIN_
metrics will be also displayed with a TRL_ prefix, and denote the
cluster status at the end of the tiered allocation run.
The human output format should be self-explanatory, so it is not
described further.
OPTIONS
-------
......@@ -308,6 +319,13 @@ The options that can be passed to the program are as follows:
the instance count for these two modes are not related one to
another.
--machines-readable[=*choice*]
By default, the output of the program is in "human-readable" format,
i.e. text descriptions. By passing this flag you can either enable
(``--machine-readable`` or ``--machine-readable=yes``) or explicitly
disable (``--machine-readable=no``) the machine readable format
described above.
-v, --verbose
Increase the output verbosity. Each usage of this option will
increase the verbosity (currently more than 2 doesn't make sense)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment