@@ -24,34 +24,199 @@ Related Standards
2424
2525- :doc: `14/Canonical Job Specification <spec_14 >`
2626- :doc: `19/Flux Locally Unique ID <spec_19 >`
27+ - :doc: `21/Job States and Events <spec_21 >`
2728- `OpenMP Specification <https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf >`__
2829- `IETF RFC3986: Uniform Resource Identifier (URI) <https://tools.ietf.org/html/rfc3986 >`__
2930
3031
3132Goals
3233-----
3334
34- - Express the dependencies between jobs to the dependency service.
35- - Provide a mechanism for specifying dependencies as a directed acyclic graph
35+ - Define how job dependencies are represented in jobspec.
36+ - Define how job dependencies are represented as command line arguments.
37+ - Describe simple, built-in job dependency schemes.
38+ - Plan for new dependency schemes to be added later.
39+ - Describe a mechanism for specifying dependencies as a directed acyclic graph
3640 (DAG).
37- - Provide a mechanism for specifying more advanced, runtime dependencies.
41+ - Describe a mechanism for specifying more advanced, runtime dependencies.
3842
39- Job Dependency Definition
43+
44+ Background
45+ ----------
46+
47+ RFC 21 defines a DEPEND state for jobs, which is exited once all job
48+ dependencies have been satisfied, or a fatal exception has occurred.
49+ The job must progress through DEPEND and PRIORITY states before reaching
50+ SCHED state, therefore, dependency processing is independent of the scheduler.
51+
52+ When a job enters DEPEND state, job manager plugins post ``dependency-add ``
53+ events to the job eventlog, as described in RFC 21. Plugins may add
54+ dependencies based on explicit user requests in the jobspec, or based on
55+ other implementation-dependent criteria.
56+
57+ As dependencies are satisfied, job manager plugins post ``dependency-remove ``
58+ events to the job eventlog, as described in RFC 21. The job may leave DEPEND
59+ state once all added dependencies have been removed.
60+
61+ Built-in job manager plugins handle the simple dependency schemes described
62+ below. Job manager plugins may be added to handle new schemes as needed.
63+ Plugins may be self contained, or may outsource dependency processing to a
64+ service outside of the job manager; for example, a separate broker module
65+ or an entity that is not part of Flux.
66+
67+ Dependency Event Semantics
68+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
70+ Dependency events SHALL only be posted to the job eventlog by job manager
71+ plugins.
72+
73+ Dependency events SHALL be treated as matching when their ``description ``
74+ fields have the same value.
75+
76+ A dependency SHALL be considered satisfied when matching ``dependency-add ``
77+ and ``dependency-remove `` events have been posted.
78+
79+ Some special semantics for these events are needed to allow plugins
80+ to reacquire their internal state when the job manager is restarted:
81+
82+ Attempts to post duplicate ``dependency-add `` events for unsatisfied
83+ dependencies SHALL NOT raise a plugin error and SHALL NOT be posted.
84+
85+ Attempts to post duplicate ``dependency-add `` events for satisfied
86+ dependencies SHALL raise a plugin error.
87+
88+
89+ Representation
90+ --------------
91+
92+ A job dependency SHALL be represented as a JSON object with the following
93+ REQUIRED keys:
94+
95+ scheme
96+ (string) name of the dependency scheme
97+
98+ value
99+ (string) semantics determined by the scheme.
100+
101+ A dependency object MAY contain additional OPTIONAL key-value pairs,
102+ whose semantics are determined by the scheme.
103+
104+ in jobspec
105+ ~~~~~~~~~~
106+
107+ Each dependency requested by the user SHALL be represented as an element in
108+ the jobspec ``attributes.system.dependencies `` array. Each element SHALL
109+ conform to the object definition above.
110+
111+ If job requests no dependencies, the key ``attributes.system.dependencies ``
112+ SHALL NOT be added to the jobspec.
113+
114+ on command line
115+ ~~~~~~~~~~~~~~~
116+
117+ On the command line, a job dependency MAY be expressed in a compact, URI-like
118+ form, with the first OPTIONAL key-value pair represented as a URI query
119+ string, and additional OPTIONAL key-value pairs represented as URI query
120+ options (``& `` or ``; `` delimited):
121+
122+ ::
123+
124+ scheme:value[?key=val[&key=val...]]
125+
126+ Examples:
127+
128+ - ``afterany:ƒ2oLkTLb ``
129+ - ``string:foo?type=out ``
130+ - ``fluid:hungry-hippos-white-elephant ``
131+
132+ This form SHOULD be translated by the command line tool to the object
133+ form above before being shared with other parts of the system.
134+
135+
136+ Simple Dependencies
137+ -------------------
138+
139+ The following dependency schemes are built-in.
140+
141+ after
142+ ~~~~~
143+
144+ ``value `` SHALL be interpreted as the antecedent jobid, in any valid
145+ FLUID encoding from RFC 19.
146+
147+ The dependency SHALL be satisfied once the antecedent job enters RUN state.
148+ If the antecedent job reaches INACTIVE state without entering RUN state,
149+ a fatal exception SHOULD be raised on the dependent job.
150+
151+
152+ afterany
153+ ~~~~~~~~
154+
155+ ``value `` SHALL be interpreted as the antecedent jobid, in any valid
156+ FLUID encoding from RFC 19.
157+
158+ The dependency SHALL be satisfied once the antecedent job enters INACTIVE
159+ state, regardless of result.
160+
161+ afterok
162+ ~~~~~~~
163+
164+ ``value `` SHALL be interpreted as the antecedent jobid, in any valid
165+ FLUID encoding from RFC 19.
166+
167+ The dependency SHALL be satisfied once the antecedent job enters INACTIVE
168+ state, with a successful result. If the antecedent job does not conclude
169+ successfully, a fatal exception SHOULD be raised on the dependent job.
170+
171+ afternotok
172+ ~~~~~~~~~~
173+
174+ ``value `` SHALL be interpreted as the antecedent jobid, in any valid
175+ FLUID encoding from RFC 19.
176+
177+ The dependency SHALL be satisfied once the antecedent job enters INACTIVE
178+ state, with an unsuccessful result. If the antecedent job concludes
179+ successfully, a fatal exception SHOULD be raised on the dependent job.
180+
181+
182+ OpenMP-style Dependencies
40183-------------------------
41184
42- A dependency SHALL be a dictionary containing the following keys (whose
43- definitions are detailed in the sections below):
185+ The ``string `` and ``fluid `` schemes are reserved for more sophisticated
186+ symbolic and jobid based dependencies, inspired by the OpenMP specification.
187+
188+ string
189+ ~~~~~~
44190
45- - **type **
46- - **scope **
47- - **scheme **
48- - **value **
191+ ``value `` SHALL be interpreted as a symbolic dependency name.
192+
193+ In addition, the following keys are REQUIRED for this scheme:
194+
195+ type
196+ (string) ``in ``, ``out ``, or ``inout `` as described below.
197+
198+ scope
199+ (string) ``user `` or ``global `` as described below.
200+
201+ fluid
202+ ~~~~~
203+
204+ ``value `` SHALL be interpreted as a jobid, in any valid FLUID encoding from
205+ RFC 19.
206+
207+ type
208+ (string) ``in ``, ``out ``, or ``inout `` as described below.
209+
210+ scope
211+ (string) ``user `` or ``global `` as described below.
212+
213+ A dependency of this ``scheme `` with a ``type `` of ``out `` SHALL be generated
214+ automatically for every job when OpenMP-style dependencies are active.
49215
50216Type
51217~~~~
52218
53- The value of the ``type `` key SHALL be one of the following (the semantics of
54- which are inspired by the OpenMP specification):
219+ The value of the ``type `` key SHALL be one of the following:
55220
56221- **out ** This key only affects future submitted jobs. If the value of this key
57222 is the same as the value in an ``in `` or ``inout `` dependency of a future
@@ -81,40 +246,9 @@ The value of the ``scope`` key SHALL be one of the following:
81246 of any type within this scope. A non-instance owner can only create a
82247 dependency with the type ``in `` within this scope.
83248
84- Scheme
85- ~~~~~~
86-
87- The value of the ``scheme `` key SHALL be a string. Valid values MAY be but are
88- not limited to the following:
89-
90- - **string ** The ``value `` is to be interpreted as a string literal.
91-
92- - **fluid ** The ``value `` is to be interpreted as a Flux Locally Unique ID. A
93- dependency of this ``scheme `` with a ``type `` of ``out `` SHALL be generated
94- automatically for every job by the job dependency system.
95-
96- Value
97- ~~~~~
98-
99- The value of the ``value `` key SHALL be a string, whose semantics are
100- determined by the ``scheme ``.
101-
102- Shorthand
103- ---------
104-
105- For convenience at the command line, dependencies MAY be formatted as a
106- `Uniform Resource Identifier (URI) <https://tools.ietf.org/html/rfc3986 >`__ and
107- then expanded into the dictionary format described above. It is left up to each
108- implementation as to which URIs to support, the URIs' semantics, default values,
109- and what to do when an unsupported URI is encountered. Some example URIs
110- include:
111-
112- - ``string:foo ``
113- - ``string:foo?type=out ``
114- - ``fluid:hungry-hippos-white-elephant ``
115249
116250Examples
117- --------
251+ ~~~~~~~~
118252
119253Under the description above, the following are examples of fully compliant
120254dependency declarations.
0 commit comments