From d00ac4078f6d923452d12bb58932f28db75a6955 Mon Sep 17 00:00:00 2001 From: vsoch Date: Mon, 18 Mar 2024 17:42:39 -0600 Subject: [PATCH] schema: cleanup nested task Problem: it did not make sense to have a task list that only allows one item Solution: use the flattened object (dict) instead Signed-off-by: vsoch --- jobspec/schema.py | 78 ++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/jobspec/schema.py b/jobspec/schema.py index 4609956..4ab4340 100644 --- a/jobspec/schema.py +++ b/jobspec/schema.py @@ -54,9 +54,7 @@ }, }, "type": "object", - # NOTE that I removed attributes, I don't see why they need to be required "required": ["version", "resources", "task"], - # "required": ["version", "resources", "attributes", "tasks"], "properties": { "version": { "description": "the jobspec version", @@ -94,54 +92,50 @@ "task": { "description": "task configuration", "type": "object", - "maxItems": 1, - "items": { - "type": "object", - "required": ["slot", "count", "command"], - "properties": { - "command": { - "type": ["string", "array"], - "minItems": 1, - "items": {"type": "string"}, - }, - # This could be embedded as a yaml file, and then - # executed with jobspec if it's not wanted here - "transform": { - "type": ["array"], - "minItems": 1, - "items": { - "type": "object", - "properties": { - "step": {"type": "string"}, - }, - "required": ["step"], - }, - }, - # RESOURCES AND SCRIPTS ARE EXPERIMENTAL - "resources": {"type": "object"}, - "scripts": { - "type": "array", - "items": { - "type": "object", - "required": ["name", "content"], - "properties": { - "name": {"type": "string"}, - "content": {"type": "string"}, - }, + "required": ["slot", "count"], + "properties": { + "command": { + "type": ["string", "array"], + "minItems": 1, + "items": {"type": "string"}, + }, + # This could be embedded as a yaml file, and then + # executed with jobspec if it's not wanted here + "transform": { + "type": ["array"], + "minItems": 1, + "items": { + "type": "object", + "properties": { + "step": {"type": "string"}, }, + "required": ["step"], }, - "slot": {"type": "string"}, - "count": { + }, + # RESOURCES AND SCRIPTS ARE EXPERIMENTAL + "resources": {"type": "object"}, + "scripts": { + "type": "array", + "items": { "type": "object", - "additionalProperties": False, + "required": ["name", "content"], "properties": { - "per_slot": {"type": "integer", "minimum": 1}, - "total": {"type": "integer", "minimum": 1}, + "name": {"type": "string"}, + "content": {"type": "string"}, }, }, }, - "additionalProperties": False, + "slot": {"type": "string"}, + "count": { + "type": "object", + "additionalProperties": False, + "properties": { + "per_slot": {"type": "integer", "minimum": 1}, + "total": {"type": "integer", "minimum": 1}, + }, + }, }, + "additionalProperties": False, }, }, }