|
| 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_26.html |
| 4 | +
|
| 5 | +31/Job Constraints Specification |
| 6 | +================================ |
| 7 | + |
| 8 | +This specification describes an extensible format for the description of |
| 9 | +job constraints. |
| 10 | + |
| 11 | +- Name: github.com/flux-framework/rfc/spec_26.rst |
| 12 | +- Editor: Mark A. Grondona < [email protected]> |
| 13 | +- State: raw |
| 14 | + |
| 15 | +Language |
| 16 | +-------- |
| 17 | + |
| 18 | +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", |
| 19 | +"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to |
| 20 | +be interpreted as described in `RFC 2119 <https://tools.ietf.org/html/rfc2119>`__. |
| 21 | + |
| 22 | +Related Standards |
| 23 | +----------------- |
| 24 | + |
| 25 | +- :doc:`14/Canonical Job Specification <spec_14>` |
| 26 | +- :doc:`20/Resource Set Specification Version 1 <spec_20>` |
| 27 | + |
| 28 | +Goals |
| 29 | +----- |
| 30 | + |
| 31 | +- Define a format for the specification of general constraints in jobspec |
| 32 | +- Embed extensibility into the format to allow for growth of feature set |
| 33 | + |
| 34 | +Background |
| 35 | +---------- |
| 36 | + |
| 37 | +It is common practice for resource management systems to allow job |
| 38 | +requests to contain constraints beyond the size and count of resources |
| 39 | +that are being requested. Most often, these constraints specify a set |
| 40 | +of allowable features or *properties* which the assigned resources must |
| 41 | +satisfy. However more complex constraint satisfaction problems are often |
| 42 | +supported to allow for advanced resource matching. |
| 43 | + |
| 44 | +This RFC defines an extensible format for the specification of job |
| 45 | +constraints in JSON. |
| 46 | + |
| 47 | +Representation |
| 48 | +-------------- |
| 49 | + |
| 50 | +Job constraints SHALL be represented as a JSON object, which loosely |
| 51 | +follows the `JsonLogic <https://jsonlogic.com/>`_ format of |
| 52 | + |
| 53 | +.. code:: json |
| 54 | +
|
| 55 | + { "operator": [ "values", ] } |
| 56 | +
|
| 57 | +where each ``value`` can also be a constraint object. This format has |
| 58 | +several advantages: |
| 59 | + |
| 60 | + * The set of supported operators can be restricted for ease of implementation |
| 61 | + then later extended for additional functionality |
| 62 | + * The format allows nesting to support complex constraints |
| 63 | + * Simple cases can be expressed simply |
| 64 | + |
| 65 | +In this version of the RFC, only the following constraint operators SHALL be |
| 66 | +supported |
| 67 | + |
| 68 | + - ``properties``: The set of values SHALL designate a set of required |
| 69 | + properties on execution targets. As a special case, if a property value |
| 70 | + begins with the character ``^``, then the remaining part of the value |
| 71 | + SHALL indicate a property that MUST NOT be included in the allocated |
| 72 | + resource set. |
| 73 | + |
| 74 | +Future extensions |
| 75 | +~~~~~~~~~~~~~~~~~ |
| 76 | + |
| 77 | +The following constraint operators MAY be supported. If a job is submitted |
| 78 | +using these constraint operators, and the operators are not supported by |
| 79 | +the instance, then the job SHALL be rejected with an appropriate error |
| 80 | +message: |
| 81 | + |
| 82 | + - ``not``: Logical negation. Takes a single value and negates it. For |
| 83 | + example, to constrain a job to only those resources that do not have |
| 84 | + a set of attributes ``foo`` and ``bar``, the following expression could |
| 85 | + be used |
| 86 | + |
| 87 | + .. code:: json |
| 88 | +
|
| 89 | + { "not": [{ "properties": [ "foo", "bar" ]}] } |
| 90 | +
|
| 91 | + - ``or``: Simple logical ``or``. Evaluates true if any one of the ``value`` |
| 92 | + arguments is true, e.g. to constrain jobs to resources that have either |
| 93 | + ``foo`` *or* ``bar``: |
| 94 | + |
| 95 | + .. code:: json |
| 96 | +
|
| 97 | + { "or": [{ "properties": [ "foo" ]}, { "properties": [ "bar" ]}] } |
| 98 | +
|
| 99 | + |
| 100 | + - ``and``: Simple logical ``and``. |
| 101 | + |
| 102 | +Examples |
| 103 | +-------- |
| 104 | + |
| 105 | +Constrain resources such that all execution targets have property ``ssd``: |
| 106 | + |
| 107 | +.. code:: json |
| 108 | +
|
| 109 | + { "properties": [ "ssd" ] } |
| 110 | +
|
| 111 | +Constrain resources such that no execution targets with property ``slowgpu`` |
| 112 | +are allocated: |
| 113 | + |
| 114 | +.. code:: json |
| 115 | +
|
| 116 | + { "properties": [ "^slowgpu" ] } |
| 117 | +
|
| 118 | +
|
0 commit comments