Commit e1d2a0c1 authored by Matthieu Hautreux's avatar Matthieu Hautreux Committed by Morris Jette
Browse files

[PATCH 04/17] config parser: add several modifications required by layouts management

> add a new 'operator' field in s_p_values_t

Provide the capability to manage key[+-*/]=val entries in the parsing logic.
A new operator field now enables to know which operation is associated to
a pair of key/value instead of the classical set. Introduced operators are
provided by the slurm_parser_operator_t type with the following value :

 * S_P_OPERATOR_ADD
 * S_P_OPERATOR_SUB
 * S_P_OPERATOR_MUL
 * S_P_OPERATOR_DIV
 * S_P_OPERATOR_MIN
 * S_P_OPERATOR_MAX
 * S_P_OPERATOR_AVG

It is the caller of the parsing logic that is responsible of using that
information in order to act as requested. The parsing logic do not do any
computation based on the extracted operator.

S_P_OPERATOR_{MIN,MAX,AVG} are internal operators not yet bound to particular
char in the parsing logic of 'key[operator]=val' entries. They are only used
for layouts internal logic.

Why:

Introducing the layouts framework, the parsing logic of SLURM was extended to
manage efficiently conf elements expansions. Layouts heavily rely on the SLURM
parser to tansform textual configurations into internal representations.

Looking at a way to provide live update of Layouts information, it was
interesting to reuse the parsing logic of SLURM instead of trying to do the
same thing somewhere else.

Introducing a "key[+-*/]=val" feature was thus mandatory in order to apply
numerical modifications of the layouts internal states on the controller side
instead of trying to compute that on the client side and then send the updated
information, loosing the capability to perform operations atomicallly.

> add S_P_{FLOAT,DOUBLE,LONG_DOUBLE} and related s_p_get_* functions

> enable true/false string parameter with S_P_BOOLEAN

Layouts logic was using true/false instead of yes/no|0/1|up/down
that were supported with S_P_BOOLEAN. Add true/false instead of reverting
to one of the already available parameters as it was strange to not have them.

> add "_." as valid characters in key names

> add s_p_parse_buffer to parse configuration lines from a Slurm Buffer

s_p_parse_file is a convenient way to handle the parsing of Slurm configuration
file. It however only works with traditional file and can not be used to process
a bunch of configuration strings.

s_p_parse_buffer provides the capability to parse a bunch of contiguous strings
packed into a Buf type, stopping the processing at the first unsuccessfull
string extraction from the buffer.
parent d3529c4f
Supports Markdown
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