-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
womtool/miniwdl validate command #265
Conversation
…e option to use miniwdl. updated womtool function use in test scripts
@@ -1,3 +1,5 @@ | |||
version 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated wdl to verison 1.0
|
||
String docker | ||
# Runtime Options: | ||
Int mem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miniwdl failed this workflow because it didn't like operating on optional int with an int
mem * 1024
So made it none optional
I would consider running both validations by default. And doing both pre-submit. |
…, moved miniwdl functions to miniwdl_utils.py
…e submitting workflow
f = io.StringIO() | ||
with redirect_stdout(f): | ||
# Importing miniwdl.check here to help with stdout redirection | ||
from WDL.CLI import check as miniwdl_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of importing in the middle of the script but this seemed the only way the stdout redirection would work. If not imported here miniwdl's linting function will print out several warnings. Which isn't helpful when running the function in the submit command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miniwdl just dumps all it's output to stdout then I'm assuming? This seems like a sane way to capture it.
) | ||
|
||
captured_outputs = f.getvalue() | ||
except Exception as exn: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here i wanted to capture any exception from miniwdl, mainly to reprint it in a cleaner way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems good to me. Definitely better to standardize them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bshifaw I have a few comments but otherwise this looks great. Thank you.
@@ -168,15 +169,16 @@ def print_version(): | |||
main_entry.add_command(alias.main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a note to keep these alphabetical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
+ ("\n".join(validate_status["errors"])) | ||
) | ||
|
||
LOGGER.debug("Skipping validation of WDL plus a dependencies zip") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no one working on fixing this particular cromwell issue is there? Should we poke them?
) | ||
|
||
captured_outputs = f.getvalue() | ||
except Exception as exn: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems good to me. Definitely better to standardize them.
captured_outputs = f.getvalue() | ||
except Exception as exn: | ||
# Importing miniwdl.print_error here to help with stdout redirection | ||
from WDL.CLI import print_error as miniwdl_print_error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still under the stdout redirect in this scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
f = io.StringIO() | ||
with redirect_stdout(f): | ||
# Importing miniwdl.check here to help with stdout redirection | ||
from WDL.CLI import check as miniwdl_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miniwdl just dumps all it's output to stdout then I'm assuming? This seems like a sane way to capture it.
# Importing miniwdl.check here to help with stdout redirection | ||
from WDL.CLI import check as miniwdl_check | ||
|
||
miniwdl_check( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming miniwdl doesn't offer a clean way to get the results without just scraping the output logs? It would be cleaner if we didn't have to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I know of, having it directed to a variable didn't do anything
@click.command(name="validate") | ||
@click.argument("wdl", type=click.Path(exists=True), required=True) | ||
@click.argument("wdl_json", type=click.Path(exists=True), required=False) | ||
@click.option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In submit this is "--dependencies-zip
. We should probably make this match. (Or maybe we should change it in submit?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miniwdl allows users to provide more than one folder to look for dependencies.
I can make it match the submit
command so that users can only provide one folder (or zip) to send to miniwdl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, so now you can provide a zip or a path to a directory and it will provide it to miniwdl. I noticed that it doesn't handle nested workflows well (when the main workflow is in a child directory separate from its imported workflows). However it should be possible to reuse the same logic in the nested wdl PR to resolve it.
My comments are all basically questions, only real actionable thing is changing the argument name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
type=click.Path(exists=True), | ||
help="MiniWDL option: Directory containing workflow source files that are " | ||
"used to resolve local imports. (can supply multiple times)", | ||
help="MiniWDL option: ZIP file or directory containing workflow source files " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessible to... what? WHAT is it accessible to? The mystery is killing me! :)
@@ -89,9 +89,11 @@ def main( | |||
wdl=str(wdl), wdl_json=str(wdl_json), config=config | |||
) | |||
|
|||
# Todo: Have it support nested directories after PR 268 is merged | |||
# https://github.com/broadinstitute/cromshell/pull/268 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
# Define a temporary directory for testing | ||
@pytest.fixture(scope="function") | ||
def temp_dir(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest fixtures are neat.
Added a command that validates wdl workflows using miniwdl package
Updated HelloWorld.wdl to verison1.0