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
Further improvements to DAG handling #73
Conversation
This wraps the Snakemake API call in a custom context manager class that checks if we are printing a DAG, and if we are, when we enter the context, sets up stdout to be a file buffer, and assembles the buffer contents into a list when done.
Example commands:
|
TODO: add tests |
78153d9
to
aaa7f63
Compare
Oh, and hey, look at that - a blog post from May 2014 on context managers, which we used in this pull request, from @camillescott - http://www.camillescott.org/2014/05/05/context-management/ |
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.
Thanks Charles!!! This looks awesome and definitely nicer to use. What do you think about putting the CaptureStdout
class in a file in the ep_utils
folder to keep things cleaner within run_eelpond
?
Good idea! I went ahead and made those changes. |
Before I implement a test for this, I just wanted to make some notes here about the eelpond testing approach. I just noticed the tests you're running are in the If you then use the context manager approach to capture stdout from that subprocess call that would allow capturing the output from the Snakemake test (edit: on second thought you may be able to do this with subprocess's I'll put together a unit test for the new |
12afda9
to
b73270d
Compare
* Add eelpond tests/ directory This adds individual unit tests for each of eelpond's flags. Not all of these flag unit tests are implemented yet, but the --dag and --dagfile flags are tested, as are the --help and --dry-run flags, to demonstrate how to do it. * fill in --dagpng test. clean up test_flags test * add pytest to environment.yml, add pytest command to travis
Pull request to expand #69 to handle three directed acyclic graph flags:
--dag
- prints workflow dag in dot format to stdout--dagfile=<dotfile>
- prints workflow dag in dot format to a dot file--dagpng=<pngfile>
- uses dot to turn the graphviz dot output from snakemake into a pngThese flags all turn on the
--dry-run
flag.To accomplish the second two flags, I implemented a context manager that will capture stdout when the user is creating the directed acyclic graph, and either prints that captured output to the screen (if the user passes the
--dag
flag, keeping that flag working as @bluegenes implemented it in #69), or prints the captured output to a file (if the user passes the--dagfile
flag), or uses dot to pass the captured output to dot and convert it into a png file (if the user passes the--dagpng
flag).