Skip to content

Commit

Permalink
rfc31: add RFC 31: Job Constraints Specification
Browse files Browse the repository at this point in the history
Problem: There is no defintion of how to encode job constraints in
a standardized format.

Introduce RFC 31: Job Constraints Specification, which includes a simple,
but extensible format for encoding job constraints, inspired by the
json-logic definition at https://jsonlogic.com.
  • Loading branch information
grondo committed Mar 11, 2022
1 parent 5893019 commit 32e5f1e
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Table of Contents
- [28/Flux Resource Acquisition Protocol Version 1](spec_28.rst)
- [29/Hostlist Format](spec_29.rst)
- [30/Job Urgency](spec_30.rst)
- [31/Job Constraints Specification](spec_31.rst)

Build Instructions
------------------
Expand Down
1 change: 1 addition & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,4 @@ This specification describes the Flux job urgency parameter.
spec_28
spec_29
spec_30
spec_31
125 changes: 125 additions & 0 deletions spec_31.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
.. github display
GitHub is NOT the preferred viewer for this file. Please visit
https://flux-framework.rtfd.io/projects/flux-rfc/en/latest/spec_26.html
31/Job Constraints Specification
================================

This specification describes an extensible format for the description of
job constraints.

- Name: github.com/flux-framework/rfc/spec_26.rst
- Editor: Mark A. Grondona <[email protected]>
- State: raw

Language
--------

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to
be interpreted as described in `RFC 2119 <https://tools.ietf.org/html/rfc2119>`__.

Related Standards
-----------------

- :doc:`14/Canonical Job Specification <spec_14>`
- :doc:`20/Resource Set Specification Version 1 <spec_20>`

Goals
-----

- Define a format for the specification of general constraints in jobspec
- Embed extensibility into the format to allow for growth of feature set

Background
----------

It is common practice for resource management systems to allow job
requests to contain constraints beyond the size and count of resources
that are being requested. Most often, these constraints specify a set
of allowable features or *properties* which the assigned resources must
satisfy. However more complex constraint satisfaction problems are often
supported to allow for advanced resource matching.

This RFC defines an extensible format for the specification of job
constraints in JSON.

Representation
--------------

Job constraints SHALL be represented as a JSON object, which loosely
follows the `JsonLogic <https://jsonlogic.com/>`_ format of

.. code:: json
{ "operator": [ "values", ] }
where each ``value`` can also be a constraint object. This format has
several advantages:

* The set of supported operators can be restricted for ease of implementation
then later extended for additional functionality
* The format allows nesting to support complex constraints
* Simple cases can be expressed simply

In this version of the RFC, only the following constraint operators SHALL be
supported

- ``properties``: The set of values SHALL designate a set of required
properties on execution targets. As a special case, if a property value
begins with the character ``^``, then the remaining part of the value
SHALL indicate a property that MUST NOT be included in the allocated
resource set.

The following constraint operators MAY be supported. If a job is submitted
using these constraint operators, and the operators are not supported by
the instance, then the job SHALL be rejected with an appropriate error
message:

- ``not``: Logical negation. Takes a single value and negates it. For
example, to constrain a job to only those resources that do not have
a set of attributes ``foo`` and ``bar``, the following expression could
be used

.. code:: json
{ "not": [{ "properties": [ "foo", "bar" ]}] }
- ``or``: Simple logical ``or``. Evaluates true if any one of the ``value``
arguments is true, e.g. to constrain jobs to resources that have either
``foo`` *or* ``bar``:

.. code:: json
{ "or": [{ "properties": [ "foo" ]}, { "properties": [ "bar" ]}] }
- ``and``: Simple logical ``and``. Evaluates to true only if all ``value``
arguments are true, e.g.

.. code:: json
{ "and":
[ {"properties": [ "a" ] },
{ "not": [{ "properties": [ "foo", "bar" ]}
]
}
Examples
--------
Constrain resources such that all execution targets have property ``ssd``:
.. code:: json
{ "properties": [ "ssd" ] }
Constrain resources such that no execution targets with property ``slowgpu``
are allocated:
.. code:: json
{ "properties": [ "^slowgpu" ] }

0 comments on commit 32e5f1e

Please sign in to comment.