Repository: reframe-hpc/reframe

Issue:
Configuration validation error when `sched_options` is set inside a partition
Although this is the only way to define scheduler options in ReFrame 4.0, this does not work. 

## How to reproduce

Add the following in one of your partitions:

```python
                    'sched_options': {
                        'use_nodes_options': True
                    }
```

Then loading this configuration file, you get the following error:

```console
ERROR: failed to load configuration: could not validate configuration files: '['<builtin>', 'config/machines.py']': Additional properties are not allowed ('sched_options' was unexpected)
```

Discussion:

Patch:
diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json
index d9108b36..2ca913db 100644
--- a/reframe/schemas/config.json
+++ b/reframe/schemas/config.json
@@ -102,18 +102,6 @@
                 }
             ]
         },
-        "sched_options": {
-            "type": "object",
-            "properties": {
-                "ignore_reqnodenotavail": {"type": "boolean"},
-                "job_submit_timeout": {"type": "number"},
-                "resubmit_on_errors": {
-                    "type": "array",
-                    "items": {"type": "string"}
-                },
-                "use_nodes_option": {"type": "boolean"}
-            }
-        },
         "stream_handler": {
             "allOf": [
                 {"$ref": "#/defs/handler_common"},
@@ -268,6 +256,19 @@
                                         "sge", "slurm", "squeue", "torque"
                                     ]
                                 },
+                                "sched_options": {
+                                    "type": "object",
+                                    "properties": {
+                                        "ignore_reqnodenotavail": {"type": "boolean"},
+                                        "job_submit_timeout": {"type": "number"},
+                                        "resubmit_on_errors": {
+                                            "type": "array",
+                                            "items": {"type": "string"}
+                                        },
+                                        "use_nodes_option": {"type": "boolean"}
+                                    },
+                                    "additionalProperties": false
+                                },
                                 "launcher": {
                                     "type": "string"
                                 },


Test patch:
diff --git a/unittests/resources/config/settings.py b/unittests/resources/config/settings.py
index b31421f0..a7746fb1 100644
--- a/unittests/resources/config/settings.py
+++ b/unittests/resources/config/settings.py
@@ -62,6 +62,9 @@ site_configuration = {
                     'container_platforms': [{'type': 'Sarus'}],
                     'environs': ['PrgEnv-gnu', 'builtin'],
                     'max_jobs': 10,
+                    'sched_options': {
+                        'use_nodes_option': False
+                    },
                     'processor': {
                         'arch': 'skylake',
                         'num_cpus': 8,
diff --git a/unittests/test_config.py b/unittests/test_config.py
index 8e70c572..aee8d646 100644
--- a/unittests/test_config.py
+++ b/unittests/test_config.py
@@ -295,6 +295,9 @@ def test_select_subconfig(site_config):
     assert (site_config.get('systems/0/partitions/0/env_vars') ==
             [['FOO_GPU', 'yes']])
     assert site_config.get('systems/0/partitions/0/max_jobs') == 10
+    assert site_config.get('systems/0/partitions/0/sched_options') == {
+        'use_nodes_option': False
+    }
     assert site_config.get('environments/@PrgEnv-gnu/cc') == 'cc'
     assert site_config.get('environments/1/cxx') == 'CC'
     assert site_config.get('general/0/check_search_path') == ['c:d']