WDL workflow inputs validation
Project description
winval
Workflow inputs validation python library
- Currently, supports WDL workflows.
- Constraints on inputs can be written as specially tagged (#@wv) comments in the WDL inputs section.
- The syntax of constraints is a python-similar DSL, with ANTLR defined grammar.
- The WDL + inputs.json can be validated using a script/function before submitting a workflow.
Usage:
validate_wdl_constraints
From unix command-line:
python winval/validate_wdl_constraints.py --wdl <wdl_file> --json <json_file>
From python
from winval.validate_wdl_constraints import run_winval
is_validated = run_winval(wdl_file, json_file)
cloud_files_validater
Make sure google-storage permissions are equivalent to the batch workers permissions
From unix command-line:
python winval/cloud_files_validator.py --wdl <wdl_file> --json <json_file>
From python
from winval.cloud_files_validator import CloudFilesValidator
is_validated = CloudFilesValidator(args.wdl, args.json).validate()
WDL constraints example
workflow MyWorkflow {
input {
File file
Int c
File* opt_file_1
File* opt_file_2
Array[File] files
Array[File] index_files
MyStruct struct_instance
#@wv defined(opt_file_1) <-> defined(opt_file_2)
#@wv defined(opt_file_1) -> c > 1
#@wv len(files) == len(index_files)
#@wv len(files) >= 0
#@wv len(index_files) >= 0
#@wv c <= 1 and c >= 0
#@wv suffix(file) == ".fasta"
#@wv suffix(files) <= {".bam", ".cram"}
#@wv prefix(index_files) == files
#@wv len(struct_instance['field_a']) > 0
}
...
}
struct MyStruct{
String field_a,
String field_b
}
Generate parsers from grammar:
cd <project_root>/winval
antlr4 -Dlanguage=Python3 winval.g4 -visitor -o antlr
Available atomic expressions:
- int: 5
- float: 5.6
- bool: True, False
- str: "some string", 'some_string'
- workflow_variable: my_var
- evaluates to value given by json conf, or None if not defined in json
- empty_set: {}
Available python operators
+,-,*,**,/,&,|,%and,or,in<,<=,==,>=,>,!=- Notice the following useful operators work for sets:
-: set subtraction&: set intersection|: is set union<=: subset
Available python functions
len(),not()basename(),splitext()(from os.path)
Available convenience functions and operators:
x <-> y: if-and-only-if logical operator (if x is true if and only if y is true)x -> y: implies logical operator (if x is true then y should be true)defined(x): if x a defined variableprefix(x): return path prefix of String/File or list of prefixes forsuffix(x): return path suffix of String/File or set of suffixes for Array[String]/Array[File]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
winval-0.3.2.tar.gz
(23.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
winval-0.3.2-py3-none-any.whl
(28.1 kB
view details)
File details
Details for the file winval-0.3.2.tar.gz.
File metadata
- Download URL: winval-0.3.2.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.15 CPython/3.7.8 Linux/5.10.102.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f795922cbfc19a6216aa0519300b436ec0da4169277384ce27d9b2d9fa14076e
|
|
| MD5 |
a06e57aecc0c641ab591a9abe94bbadc
|
|
| BLAKE2b-256 |
03795a9f6febb2e9c61f0c0f0f413924622c6d6e315122c543ae575702e5c18e
|
File details
Details for the file winval-0.3.2-py3-none-any.whl.
File metadata
- Download URL: winval-0.3.2-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.15 CPython/3.7.8 Linux/5.10.102.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62fa17181e67dd5a6a77b87be85083c21fa281914c20a90f9348a910e64c45d7
|
|
| MD5 |
03f420728f0ecef6b3123761c9687f9a
|
|
| BLAKE2b-256 |
36bb4ea7d3560e294f7250ce48ba6fb5780cb4a00336861d6a0e70d56187d471
|