Skip to content

Commit 97d328b

Browse files
authored
Merge pull request #327 from garlick/rfc33
add new RFC for job execution protocol
2 parents f03ca22 + f890ae8 commit 97d328b

File tree

3 files changed

+259
-0
lines changed

3 files changed

+259
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Table of Contents
4242
- [29/Hostlist Format](spec_29.rst)
4343
- [30/Job Urgency](spec_30.rst)
4444
- [31/Job Constraints Specification](spec_31.rst)
45+
- [32/Flux Job Execution Protocol Version 1](spec_32.rst)
4546

4647
Build Instructions
4748
------------------

index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ This specification describes the Flux job urgency parameter.
222222
This specification describes an extensible format for the description of
223223
job constraints.
224224

225+
:doc:`32/Flux Job Execution Protocol Version 1 <spec_32>`
226+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227+
228+
This specification describes Version 1 of the Flux Execution Protocol
229+
implemented by the job manager and job execution system.
230+
225231
.. Each file must appear in a toctree
226232
.. toctree::
227233
:hidden:
@@ -256,3 +262,4 @@ job constraints.
256262
spec_29
257263
spec_30
258264
spec_31
265+
spec_32

spec_32.rst

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
.. github display
2+
GitHub is NOT the preferred viewer for this file. Please visit
3+
https://flux-framework.rtfd.io/projects/flux-rfc/en/latest/spec_32.html
4+
5+
32/Flux Job Execution Protocol Version 1
6+
========================================
7+
8+
This specification describes Version 1 of the Flux Job Execution Protocol
9+
implemented by the job manager and job execution system.
10+
11+
- Name: github.com/flux-framework/rfc/spec_32.rst
12+
13+
- Editor: Jim Garlick <[email protected]>
14+
15+
- State: raw
16+
17+
18+
Language
19+
--------
20+
21+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
22+
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to
23+
be interpreted as described in `RFC 2119 <https://tools.ietf.org/html/rfc2119>`__.
24+
25+
26+
Related Standards
27+
-----------------
28+
29+
- :doc:`14/Canonical Job Specification <spec_14>`
30+
31+
- :doc:`15/Independent Minister of Privilege for Flux: The Security IMP <spec_15>`
32+
33+
- :doc:`16/KVS Job Schema <spec_16>`
34+
35+
- :doc:`21/Job States and Events <spec_21>`
36+
37+
- :doc:`27/Flux Resource Allocation Protocol Version 1 <spec_27>`
38+
39+
Background
40+
----------
41+
42+
The job execution service launches Flux job shells on execution targets at
43+
the behest of the job manager. The job shells in turn launch one or more
44+
user processes that comprise the job. The job execution service thus acts
45+
as an intermediary between the job manager and a set of job shells.
46+
47+
RFC 16 describes the division of labor among Flux job services, and how they
48+
share information via the KVS Job Schema. The Flux Execution Protocol version
49+
1 defines the minimal interactions between the job manager and the execution
50+
service needed to synchronize the concurrent progress of multiple jobs through
51+
their running phase.
52+
53+
As a reminder, the job execution service runs as the unprivileged Flux
54+
instance owner. In a multi-user Flux instance, it launches Flux job shells
55+
via the IMP as described in RFC 15, with the IMP managing the user transition
56+
after authenticating the signed job request from the KVS. The security
57+
aspects of launching a job as another user are not reflected in the job
58+
execution protocol.
59+
60+
Design Criteria
61+
---------------
62+
63+
The job execution protocol must adhere to these criteria:
64+
65+
- Maintain a clean separation of concerns between job manager, scheduler,
66+
execution service, and Flux job shell.
67+
68+
- Avoid presenting obstacles to the scaling of job size, the number of jobs
69+
running concurrently, or job throughput.
70+
71+
- Communicate job problems to the job manager, such that the job manager can
72+
use this information to raise job exceptions.
73+
74+
- Support partial release of allocated resources to the scheduler, in case
75+
one or more execution targets cannot be expeditiously finalized.
76+
77+
- Communicate high level job results to the job manager upon job completion.
78+
79+
- Support execution service reload.
80+
81+
- Support execution service override by the Flux simulator.
82+
83+
Implementation
84+
--------------
85+
86+
As with the scheduler RPCs described in RFC 27, ``<service>.start`` RPCs use
87+
the job ID to match requests and responses, and set the RFC 6 matchtag message
88+
field to zero. It follows that:
89+
90+
- The job ID MUST appear in the ``<service>.start`` request and response
91+
message payloads.
92+
93+
- There SHALL NOT be more than one ``<service>.start`` request in flight for
94+
each job, since otherwise a request could not be uniquely matched to a
95+
response using the job ID.
96+
97+
- The errnum field in ``<service>.start`` response messages MUST be set to
98+
zero, even if the response indicates an error. Otherwise, the message
99+
payload could not include the job ID since RFC 6 defines the payload of
100+
an error response to be optional error text.
101+
102+
- The job manager SHALL treat a conventional Flux error response to
103+
``<service>.start`` with a nonzero errnum field as an execution service
104+
fatality, and SHALL not send further requests to the execution service
105+
until it receives a new ``job-manager.exec-hello`` request.
106+
107+
The other RPCs behave conventionally.
108+
109+
Hello
110+
~~~~~
111+
112+
The Flux execution service SHALL register a service name with the job manager
113+
on initialization. This service MAY be ``job-exec`` or another name. The
114+
execution service calls the ``job-manager.exec-hello`` RPC whose request
115+
payload SHALL be a JSON object containing with one REQUIRED key:
116+
117+
service
118+
(string) execution service name
119+
120+
Example:
121+
122+
.. code:: json
123+
124+
{
125+
"service": "job-exec"
126+
}
127+
128+
If an execution service is already loaded, the job manager SHALL allow
129+
the new one to override it.
130+
131+
The response payload SHALL be empty on success. The job manager SHALL issue
132+
a failure response if any jobs have an outstanding ``start`` request to an
133+
existing execution service. The execution service SHALL treat a failure
134+
response to ``exec-hello`` as fatal.
135+
136+
Start Request
137+
~~~~~~~~~~~~~
138+
139+
Once the execution service is registered, the job manager SHALL send
140+
``<service>.start`` requests for any jobs that have been allocated resources.
141+
Each ``start`` request begins a streaming RPC that remains active while the job
142+
is running. The request payload SHALL be a JSON object containing the
143+
following REQUIRED keys:
144+
145+
id
146+
(integer) the job ID
147+
148+
userid
149+
(integer) the submitting userid
150+
151+
jobspec
152+
(object) *jobspec* object (RFC 14)
153+
154+
reattach
155+
(boolean) TBD
156+
157+
Example:
158+
159+
.. code:: json
160+
161+
{
162+
"id": 1552593348,
163+
"userid": 5588,
164+
"jobspec": {},
165+
"reattach": false,
166+
}
167+
168+
The response payload SHALL be a JSON object containing the following REQUIRED
169+
keys:
170+
171+
id
172+
(integer) the job ID, used by the job manager to match the response back
173+
to the request
174+
175+
type
176+
(string) the type of response (see below)
177+
178+
data
179+
(object) type-dependent data (see below)
180+
181+
There are four response types:
182+
183+
start
184+
Indicates that the job shells have started. ``data`` is an empty object.
185+
Example:
186+
187+
.. code:: json
188+
189+
{
190+
"id": 1552593348,
191+
"type": "start",
192+
"data": {},
193+
}
194+
195+
release
196+
Release R fragment to job-manager. ``data`` contains two keys: ``ranks``
197+
(string), an idset representing subset of execution targets whose resources
198+
may be released; and ``final`` (boolean) a flag indicating whether all the
199+
job's execution targets have now been released. Example:
200+
201+
.. code:: json
202+
203+
{
204+
"id": 1552593348,
205+
"type": "release",
206+
"data": {
207+
"ranks": "0-2",
208+
"final": true,
209+
},
210+
}
211+
212+
exception
213+
Raise an exception on the job as described in RFC 21. ``data`` contains two
214+
required keys: ``severity`` (integer), the exception severity; and ``type``
215+
(string), the exception type. A third key, ``note`` (string), is a human
216+
readable description of the exception which the job manager SHALL include
217+
in the exception context if present. Example:
218+
219+
.. code:: json
220+
221+
{
222+
"id": 1552593348,
223+
"type": "exception",
224+
"data": {
225+
"severity": 0,
226+
"type": "timeout",
227+
"note": "resource allocation expired",
228+
},
229+
}
230+
231+
finish
232+
Job is complete. ``data`` contains one required key: ``status`` (integer),
233+
the numerically greatest wait status returned by the set of job shells.
234+
Example:
235+
236+
.. code:: json
237+
238+
{
239+
"id": 1552593348,
240+
"type": "finish",
241+
"data": {
242+
"status": 143,
243+
},
244+
}
245+
246+
An ``exception`` response MAY be sent at any point. ``start`` and/or
247+
``finish`` responses MAY be omitted depending on when a fatal exception occurs.
248+
The execution service MUST always send a ``release`` response with ``final``
249+
set to True. The final ``release`` response SHALL be the last response sent
250+
by the execution service for a given job ID and is interpreted as "end of
251+
stream" by the job manager.

0 commit comments

Comments
 (0)