Skip to content

Commit

Permalink
Allow native with cores and nodes. (#554)
Browse files Browse the repository at this point in the history
* The native flag may show up with the other resources.

* Update src/uwtools/tests/test_schemas.py

Co-authored-by: NaureenBharwaniNOAA <[email protected]>

---------

Co-authored-by: NaureenBharwaniNOAA <[email protected]>
  • Loading branch information
christinaholtNOAA and NaureenBharwaniNOAA authored Aug 1, 2024
1 parent ca75423 commit a068d8c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
1 change: 1 addition & 0 deletions docs/sections/user_guide/cli/tools/rocoto/rocoto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ workflow:
account: "&ACCOUNT;"
command: "echo hello $person"
jobname: hello
native: --reservation my_reservation
nodes: 1:ppn=1
walltime: 00:01:00
envars:
Expand Down
34 changes: 17 additions & 17 deletions src/uwtools/resources/jsonschema/rocoto.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,23 @@
},
"task": {
"additionalProperties": false,
"anyOf": [
{
"required": [
"cores"
]
},
{
"required": [
"native"
]
},
{
"required": [
"nodes"
]
}
],
"dependentSchemas": {
"exclusive": {
"not": {
Expand Down Expand Up @@ -328,23 +345,6 @@
]
}
},
"oneOf": [
{
"required": [
"cores"
]
},
{
"required": [
"native"
]
},
{
"required": [
"nodes"
]
}
],
"properties": {
"account": {
"type": "string"
Expand Down
1 change: 1 addition & 0 deletions src/uwtools/tests/fixtures/hello_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ workflow:
attrs:
offset: 01:00
value: hello-@Y@m@d@H
native: --reservation my_reservation
nodes: 1:ppn=1
walltime: 00:01:00
envars:
Expand Down
12 changes: 12 additions & 0 deletions src/uwtools/tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,18 @@ def test_schema_rocoto_workflow_cycledef():
assert "'foo' is not valid" in errors([{"attrs": {"activation_offset": "foo"}, "spec": spec}])


def test_schena_rocoto_task_resources():
errors = schema_validator("rocoto", "$defs", "task", "properties")
# Basic resource options
assert not errors([{"cores": 1}])
assert not errors([{"native": "abc"}])
assert not errors([{"native": {"cyclestr": {"value": "def"}}}])
assert not errors([{"nodes": "1:ppn=12"}])
# Combined valid resources
assert not errors([{"cores": 1, "native": "abc"}])
assert not errors([{"native": "abc", "nodes": "1:ppn=12"}])


# schism


Expand Down

0 comments on commit a068d8c

Please sign in to comment.