Skip to content

Commit

Permalink
validation: make environment property mandatory in serial steps
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppe-steduto committed Nov 13, 2023
1 parent 9c6e62e commit 269a6c5
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version 0.9.4 (UNRELEASED)

- Changes the REANA specification schema to use the ``draft 2020-12`` version of the JSON schema specification.
- Changes validation of REANA specification to expose functions for loading workflow input parameters and workflow specifications.
- Changes the validation schema of the REANA specification to make the ``environment`` property mandatory for the steps of serial workflows.
- Fixes the mounting of CVMFS volumes for the REANA deployments that use non-default Kubernetes namespace.

Version 0.9.3 (2023-09-26)
Expand Down
149 changes: 143 additions & 6 deletions reana_commons/validation/schemas/reana_analysis_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,90 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"definitions": {},
"$defs": {
"cwl_specification": {
"$id": "/properties/workflow/properties/specifications?type=cwl",
"type": "object",
"title": "CWL workflow specification.",
"description": "CWL workflow specification.",
"additionalProperties": false,
"properties": {
"cwlVersion": {
"type": "string",
"title": "CWL version.",
"description": "CWL version to which the workflow was written for.",
"enum": [
"v1.0"
]
},
"class": {
"type": "string",
"title": "CWL class.",
"description": "CWL class which represents the type of the workflow.",
"enum": [
"Workflow"
]
},
"inputs": {
"type": "array",
"title": "CWL workflow inputs.",
"description": "CWL workflow inputs."
}
}
},
"serial_specification": {
"$id": "/properties/workflow/properties/specifications?type=serial",
"type": "object",
"title": "Serial workflow specification.",
"description": "Serial workflow specification.",
"additionalProperties": false,
"properties": {
"steps": {
"type": "array",
"title": "Serial workflow steps.",
"description": "List of steps which represent the workflow.",
"items": {
"properties": {
"name": {
"type": "string",
"title": "Step name."
},
"environment": {
"type": "string",
"title": "Image to be used by the container in which the step should be run."
},
"kubernetes_memory_limit": {
"type": "string",
"title": "Memory limit for the step container (e.g. 256Mi)."
},
"commands": {
"type": "array",
"title": "Step commands.",
"description": "List of commands to be run in the step.",
"items": {
"type": "string",
"title": "Command to be run."
}
}
}
}
}
}
},
"snakemake_specification": {
"$id": "/properties/workflow/properties/specifications?type=snakemake",
"type": "object",
"title": "Snakemake workflow specification.",
"description": "Snakemake workflow specification.",
"additionalProperties": false
},
"yadage_specification": {
"$id": "/properties/workflow/properties/specifications?type=yadage",
"type": "object",
"title": "Yadage workflow specification.",
"description": "Yadage workflow specification.",
"additionalProperties": false
}
},
"$id": "reana_spec",
"type": "object",
"title": "REANA analysis specification",
Expand Down Expand Up @@ -65,11 +149,6 @@
"description": "Workflow which represents the steps that need to be run to reproduce an analysis.",
"additionalProperties": false,
"properties": {
"specification": {
"$id": "/properties/workflow/properties/specification",
"type": "object",
"title": "Workflow specification in yaml format."
},
"file": {
"$id": "/properties/workflow/properties/file",
"type": "string",
Expand Down Expand Up @@ -108,6 +187,64 @@
}
}
},
"oneOf": [
{
"properties": {
"type": {
"const": "serial"
},
"specification": {
"$ref": "#/properties/workflow/properties/specifications?type=serial"
}
},
"required": [
"type",
"specification"
]
},
{
"properties": {
"type": {
"const": "cwl"
},
"specification": {
"$ref": "#/properties/workflow/properties/specifications?type=cwl"
}
},
"required": [
"type",
"specification"
]
},
{
"properties": {
"type": {
"const": "snakemake"
},
"specification": {
"$ref": "#/properties/workflow/properties/specifications?type=snakemake"
}
},
"required": [
"type",
"specification"
]
},
{
"properties": {
"type": {
"const": "yadage"
},
"specification": {
"$ref": "#/properties/workflow/properties/specifications?type=yadage"
}
},
"required": [
"type",
"specification"
]
}
],
"anyOf": [
{
"required": [
Expand Down
4 changes: 3 additions & 1 deletion reana_commons/validation/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2022 CERN.
# Copyright (C) 2022, 2023 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -77,6 +77,8 @@ def validate_reana_yaml(reana_yaml: Dict) -> Dict:
"""Validate REANA specification file according to jsonschema.
:param reana_yaml: Dictionary which represents REANA specification file.
:returns: Dictionary of non-critical warnings, in the form of
{warning_key: [warning_value1, warning_value2, ...]}.
:raises ValidationError: Given REANA spec file does not validate against
REANA specification schema.
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"checksumdir>=1.1.4,<1.2",
"click>=7.0",
"fs>=2.0",
"jsonschema[format]>=3.0.1,<4.0.0",
"jsonschema[format]>=4.0.1,<5.0.0",
"kombu>=4.6",
"mock>=3.0,<4",
"PyYAML>=5.1,<7.0",
Expand Down

0 comments on commit 269a6c5

Please sign in to comment.