From 66ff06db56c31dba799f2bcd9d9c1f12326965e7 Mon Sep 17 00:00:00 2001 From: bshifaw Date: Fri, 22 Sep 2023 16:40:06 -0400 Subject: [PATCH] Minor updates to validation command (#273) * Added validation section to README.md, error logic if womtool and miniwdl are disabled * Clearer error message, added assert_can_communicate_with_server function --------- Co-authored-by: bshifaw --- README.md | 7 +++++++ src/cromshell/validate/command.py | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 1ab25ed9..72f5d42a 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,13 @@ Cromshell is a CLI for submitting workflows to a Cromwell server and monitoring/ * `-c/--color` Color outliers in task level cost results. * `-d/--detailed` Get the cost for a workflow at the task level. + #### Validate WDL + * `validate [wdl] [input json] --dependencies-zip [wdl_zip_file]` + * Validate a WDL file. + * Runs both miniwdl and womtool validation by default, but can be configured to run only one or the other. + * Womtool validation via Cromwell server API does not support validation of imported files, however miniwdl does. + * `--dependencies-zip` MiniWDL option: ZIP file or directory containing workflow source files that are used to resolve local imports. + ## Features: * Running `submit` will create a new folder in the `~/.cromshell/${CROMWELL_URL}/` directory named with the cromwell job id of the newly submitted job. It will copy your wdl and json inputs into the folder for reproducibility. diff --git a/src/cromshell/validate/command.py b/src/cromshell/validate/command.py index 4054772f..0c69c474 100644 --- a/src/cromshell/validate/command.py +++ b/src/cromshell/validate/command.py @@ -3,6 +3,7 @@ import click +import cromshell.utilities.http_utils as http_utils import cromshell.utilities.miniwdl_utils as miniwdl import cromshell.utilities.womtool_utils as womtool @@ -80,11 +81,23 @@ def main( return_code = 0 + if no_womtool and no_miniwdl: + LOGGER.error( + "Both `--no-womtool` and `--no-miniwdl` options were used but" + "at least one validation tool must be enabled." + ) + raise MissingArgumentError( + "Both `--no-womtool` and `--no-miniwdl` options were used but " + "at least one validation tool must be enabled." + ) + if not no_womtool: if not wdl_json: LOGGER.error("WDL JSON file is required.") raise MissingArgumentError("WDL JSON file is required.") + http_utils.assert_can_communicate_with_server(config) + womtool.womtool_validate_wdl_and_json( wdl=str(wdl), wdl_json=str(wdl_json), config=config )