Skip to content

Commit 22258a8

Browse files
committed
rfc20: improve markup for readability
Problem: when describing the R JSON object, hierarchical key relationships are not visually evident. Set the default domain to js (javascript) and use nested data directives to define JSON elements, and the :data: role for mentions of them to improve formatting and add cross-reference links. See also: https://www.sphinx-doc.org/en/master/usage/domains/javascript.html
1 parent 0b43d88 commit 22258a8

File tree

1 file changed

+133
-124
lines changed

1 file changed

+133
-124
lines changed

spec_20.rst

Lines changed: 133 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
GitHub is NOT the preferred viewer for this file. Please visit
33
https://flux-framework.rtfd.io/projects/flux-rfc/en/latest/spec_20.html
44
5+
.. default-domain:: js
6+
57
#######################################
68
20/Resource Set Specification Version 1
79
#######################################
@@ -105,132 +107,139 @@ Resource Set Format Definition
105107
The JSON documents that conform to the *R* format SHALL be referred
106108
to as *R* JSON documents or in short *R* documents.
107109
An *R* JSON document SHALL consist of a dictionary with four
108-
keys: ``version``, ``execution``, ``scheduling`` and ``attributes``.
109-
It SHALL be valid if and only
110-
if it contains the ``version`` key and either or both the ``execution``
111-
and ``scheduling`` keys. The value of the ``execution`` key SHALL contain
112-
sufficient data for the execution system to perform its
113-
core tasks. The value of ``scheduling`` SHALL contain sufficient data
114-
for schedulers. Finally, the value of ``attributes`` SHALL provide
115-
optional information including but not being limited
116-
to data specific to the scheduler used to create
117-
this JSON document.
118-
119-
Version
120-
^^^^^^^
121-
122-
The value of the ``version`` key SHALL contain 1 to indicate
123-
the format version.
124-
125-
Execution
126-
^^^^^^^^^
127-
128-
The value of the ``execution`` key SHALL contain at least the keys
129-
``R_lite``, and ``nodelist``, with optional keys ``properties``,
130-
``starttime`` and ``expiration``. Other keys are reserved for future
131-
extensions.
132-
133-
``R_lite`` is a strict list of dictionaries each of which SHALL contain
134-
at least the following two keys:
135-
136-
**rank**
137-
The value of the ``rank`` key SHALL be a string list of
138-
broker rank identifiers in **idset format** (See RFC 22). This list
139-
SHALL indicate the broker ranks to which other information in
140-
the current entry applies.
141-
142-
**children**
143-
The ``children`` key encodes the information about certain compute resources
144-
contained within this compute node. The value of this key SHALL contain a dictionary
145-
with two keys: ``core`` and ``gpu``. Other keys are reserved for future
146-
extensions.
147-
148-
**core**
149-
The ``core`` key SHALL contain a logical compute core IDs string
150-
in RFC 22 **idset format**.
151-
152-
**gpu**
153-
The OPTIONAL ``gpu`` key SHALL contain a logical GPU IDs string
154-
in RFC 22 **idset format**.
155-
156-
157-
The ``nodelist`` key SHALL be an array of hostnames which correspond to
158-
the ``rank`` entries of the ``R_lite`` dictionary, and serves as a mapping
159-
of ``R_lite`` ``rank`` entries to hostname. Each entry in ``nodelist`` MAY
160-
contain a string in RFC 29 *Hostlist Format*, e.g. ``host[0-16]``.
161-
162-
The ``execution`` key MAY also contain any of the following optional keys:
163-
164-
**properties**
165-
The optional properties key SHALL be a dictionary where each key maps a
166-
single property name to a RFC 22 idset string. The idset string SHALL
167-
represent a set of execution target ranks. A given execution target
168-
rank MAY appear in multiple property mappings. Property names SHALL
169-
be valid UTF-8, and MUST NOT contain the following illegal characters:
170-
171-
::
110+
keys: :data:`version`, :data:`execution`, :data:`scheduling` and
111+
:data:`attributes`. It SHALL be valid if and only
112+
if it contains the :data:`version` key and either or both the :data:`execution`
113+
and :data:`scheduling` keys. The value of the :data:`execution` key SHALL
114+
contain sufficient data for the execution system to perform its core tasks. The
115+
value of :data:`scheduling` SHALL contain sufficient data for schedulers.
116+
Finally, the value of :data:`attributes` SHALL provide optional information
117+
including but not being limited to data specific to the scheduler used to
118+
create this JSON document.
119+
120+
.. data:: version
121+
122+
The value of the :data:`version` key SHALL contain 1 to indicate
123+
the format version.
124+
125+
.. data:: execution
126+
127+
The value of the :data:`execution` key SHALL contain at least the keys
128+
:data:`R_lite`, and :data:`nodelist`, with optional keys :data:`properties`,
129+
:data:`starttime` and :data:`expiration`. Other keys are reserved for future
130+
extensions.
131+
132+
.. data:: R_lite
133+
134+
:data:`R_lite` is a strict list of dictionaries each of which SHALL contain
135+
at least the :data:`rank` and :data:`children` keys.
136+
137+
.. data:: rank
138+
139+
The value of the :data:`rank` key SHALL be a string list of
140+
broker rank identifiers in **idset format** (See RFC 22). This list
141+
SHALL indicate the broker ranks to which other information in
142+
the current entry applies.
143+
144+
.. data:: children
145+
146+
The :data:`children` key encodes the information about certain compute
147+
resources contained within this compute node. The value of this key SHALL
148+
contain a dictionary with two keys: :data:`core` and :data:`gpu`. Other
149+
keys are reserved for future extensions.
150+
151+
.. data:: core
152+
153+
The :data:`core` key SHALL contain a logical compute core IDs string
154+
in RFC 22 **idset format**.
155+
156+
.. data:: gpu
157+
158+
The OPTIONAL :data:`gpu` key SHALL contain a logical GPU IDs string
159+
in RFC 22 **idset format**.
160+
161+
.. data:: nodelist
162+
163+
The :data:`nodelist` key SHALL be an array of hostnames which correspond to
164+
the :data:`rank` entries of the :data:`R_lite` dictionary, and serves as a
165+
mapping of :data:`R_lite` :data:`rank` entries to hostname. Each entry in
166+
:data:`nodelist` MAY contain a string in RFC 29 *Hostlist Format*, e.g.
167+
``host[0-16]``.
168+
169+
The :data:`execution` key MAY also contain any of the following optional keys:
170+
171+
.. data:: properties
172+
173+
The optional :data:`properties` key SHALL be a dictionary where each key
174+
maps a single property name to a RFC 22 idset string. The idset string SHALL
175+
represent a set of execution target ranks. A given execution target
176+
rank MAY appear in multiple property mappings. Property names SHALL
177+
be valid UTF-8, and MUST NOT contain the following illegal characters::
172178

173179
! & ' " ^ ` | ( )
174180

175-
Additionally, the ``@`` character is reserved for scheduler specific
176-
property use. In this case, the literal property SHALL still apply
177-
to the defined execution target ranks, but the scheduler MAY use the
178-
suffix after ``@`` to apply the property to children resources of the
179-
execution target or for another scheduler specific purpose. For example,
180-
the property ``amd-mi50@gpu`` SHALL apply to the defined execution
181-
target ranks, but a scheduler MAY use the ``gpu`` suffix to perform
182-
scheduling optimization for gpus of the corresponding ranks. This MAY
183-
result in both ``amd-mi50@gpu`` and ``amd-mi50`` being valid properties
184-
for resources in the instance.
185-
186-
**starttime**
187-
The value of the ``starttime`` key, if present, SHALL
188-
encode the start time at which the resource set is valid. The
189-
value SHALL be the number of seconds elapsed since the Unix Epoch
190-
(1970-01-01 00:00:00 UTC) with optional microsecond precision.
191-
If ``starttime`` is unset, then the resource set has no specified
192-
start time and is valid beginning at any time up to ``expiration``.
193-
194-
**expiration**
195-
The value of the ``expiration`` key, if present, SHALL
196-
encode the end or expiration time of the resource set in seconds
197-
since the Unix Epoch, with optional microsecond precision. If
198-
``starttime`` is also set, ``expiration`` MUST be greater than
199-
``starttime``. If ``expiration`` is unset, the resource set has no
200-
specified end time and is valid beginning at ``starttime`` without
201-
expiration.
202-
203-
Scheduling
204-
^^^^^^^^^^
205-
206-
The ``scheduling`` key MAY contain scheduler-specific resource data. It
207-
SHALL NOT be interpreted other Flux components. When used, it SHALL ride
208-
along on the resource acquisition protocol (RFC 28) and resource allocation
209-
protocol (RFC 27) so that it may be included in static configuration,
210-
allocated to jobs, and passed down a Flux instance hierarchy.
211-
212-
Attributes
213-
^^^^^^^^^^
214-
215-
The purpose of the ``attributes`` key is to provide optional
216-
information on this *R* document. The ``attributes`` key SHALL
217-
be a dictionary of one key: ``system``.
218-
Other keys are reserved for future extensions.
219-
220-
**system**
221-
Attributes in the ``system`` dictionary provide additional system
222-
information that have affected the creation of this *R* document.
223-
All of the system attributes are optional.
224-
225-
A common system attribute is:
226-
227-
**scheduler**
228-
The value of the ``scheduler`` is a free-from dictionary that
229-
may provide the information specific to the scheduler used
230-
to produce this document. For example, a scheduler that
231-
manages multiple job queues may add ``queue=batch``
232-
to indicate that this resource set was allocated from within
233-
its ``batch`` queue.
181+
Additionally, the ``@`` character is reserved for scheduler specific
182+
property use. In this case, the literal property SHALL still apply
183+
to the defined execution target ranks, but the scheduler MAY use the
184+
suffix after ``@`` to apply the property to children resources of the
185+
execution target or for another scheduler specific purpose. For example,
186+
the property ``amd-mi50@gpu`` SHALL apply to the defined execution
187+
target ranks, but a scheduler MAY use the ``gpu`` suffix to perform
188+
scheduling optimization for gpus of the corresponding ranks. This MAY
189+
result in both ``amd-mi50@gpu`` and ``amd-mi50`` being valid properties
190+
for resources in the instance.
191+
192+
.. data:: starttime
193+
194+
The value of the :data:`starttime` key, if present, SHALL
195+
encode the start time at which the resource set is valid. The
196+
value SHALL be the number of seconds elapsed since the Unix Epoch
197+
(1970-01-01 00:00:00 UTC) with optional microsecond precision.
198+
If :data:`starttime` is unset, then the resource set has no specified
199+
start time and is valid beginning at any time up to :data:`expiration`.
200+
201+
.. data:: expiration
202+
203+
The value of the :data:`expiration` key, if present, SHALL
204+
encode the end or expiration time of the resource set in seconds
205+
since the Unix Epoch, with optional microsecond precision. If
206+
:data:`starttime` is also set, :data:`expiration` MUST be greater than
207+
:data:`starttime`. If :data:`expiration` is unset, the resource set has no
208+
specified end time and is valid beginning at :data:`starttime` without
209+
expiration.
210+
211+
.. data:: scheduling
212+
213+
The :data:`scheduling` key MAY contain scheduler-specific resource data. It
214+
SHALL NOT be interpreted other Flux components. When used, it SHALL ride
215+
along on the resource acquisition protocol (RFC 28) and resource allocation
216+
protocol (RFC 27) so that it may be included in static configuration,
217+
allocated to jobs, and passed down a Flux instance hierarchy.
218+
219+
.. data:: attributes
220+
221+
The purpose of the :data:`attributes` key is to provide optional
222+
information on this *R* document. The :data:`attributes` key SHALL
223+
be a dictionary of one key: :data:`system`.
224+
225+
Other keys are reserved for future extensions.
226+
227+
.. data:: system
228+
229+
Attributes in the :data:`system` dictionary provide additional system
230+
information that have affected the creation of this *R* document.
231+
All of the system attributes are optional.
232+
233+
A common system attribute is:
234+
235+
.. describe:: scheduler
236+
237+
The value of the :data:`scheduler` key is a free-from dictionary that
238+
may provide the information specific to the scheduler used
239+
to produce this document. For example, a scheduler that
240+
manages multiple job queues may add ``queue=batch``
241+
to indicate that this resource set was allocated from within
242+
its ``batch`` queue.
234243

235244

236245
Example R
@@ -240,7 +249,7 @@ The following is an example of a version 1 resource specification.
240249
The example below indicates a resource set with the ranks 19
241250
through 22. These ranks correspond to the nodes node186 through
242251
node189. Each of the nodes contains 48 cores (0-47) and 8 gpus (0-7).
243-
The ``startime`` and ``expiration`` indicate the resources were valid
252+
The :data:`starttime` and data:`expiration` indicate the resources were valid
244253
for about 30 minutes on February 16, 2023.
245254

246255
.. literalinclude:: data/spec_20/example1.json

0 commit comments

Comments
 (0)