Repository navigation
Provenance Support for cwltool - Single Job Executor - #676
Conversation
| 'schema-salad >= 2.6.20170927145003, < 3', | ||
| 'typing >= 3.5.3', | ||
| 'six >= 1.8.0', | ||
| 'prov == 1.5.1' |
There was a problem hiding this comment.
Thanks, Added in new commit.
| @@ -0,0 +1,46 @@ | |||
|
|
|||
There was a problem hiding this comment.
I think the directory tests/wf/test-prov should be removed from this PR. You can keep it on another branch for your personal use, if you wish
There was a problem hiding this comment.
Thanks, done just now.
| pos = nx.nx_agraph.graphviz_layout(provgraph) | ||
| nx.draw(provgraph, pos=pos) | ||
| write_dot(provgraph, provDot) | ||
| check_call(['dot','-Tpng',provDot,'-o',original_path+'/ProvenanceVisualGraph.png']) |
There was a problem hiding this comment.
Mind if I make the graphviz dependency optional? I can make a PR to this PR and you can review it
There was a problem hiding this comment.
Yes, that is fine I think. We can add Prov Viewer (https://github.com/gems-uff/prov-viewer) later.
There was a problem hiding this comment.
We removed this code as it was tricky to get transitive dependencies of nx installed.
| @@ -1,3 +1,6 @@ | |||
| <<<<<<< HEAD | |||
| This is whale file for testing revsort.cwl workflow | |||
| ======= | |||
| default: | ||
| class: File | ||
| location: hello.txt | ||
| location: hello.txt |
There was a problem hiding this comment.
I think it was for the testing purpose, Wanted to see if the workflow paths still work if default is not given.
| @@ -0,0 +1 @@ | |||
| elif tset elahw si siht | |||
There was a problem hiding this comment.
Probably should be removed from this PR
| pass | ||
|
|
||
|
|
||
| # type: (bool, bool, bool, Text, **Any) -> None |
There was a problem hiding this comment.
I think the line above needs to be removed, or put where it belongs.
| from schema_salad.sourceline import SourceLine, cmap | ||
|
|
||
| from .provenance import * | ||
| from . import draft2tool, expression |
There was a problem hiding this comment.
replace draft2tool with command_line_tool
|
|
||
| def _execute(self, runtime, env, rm_tmpdir=True, move_outputs="move"): | ||
| def _execute(self, runtime, env, kwargs, document=None, WorkflowRunID=None, ProcessProvActivity=None,reference_locations=None, rm_tmpdir=True, move_outputs="move"): | ||
| # type: (List[Text], MutableMapping[Text, Text], bool, Text) -> None |
There was a problem hiding this comment.
You need to update the type signature to match the changes you made
| rm_tmpdir=True, move_outputs="move", **kwargs): | ||
| def run(self, document=None, WorkflowRunID=None, ProcessProvActivity=None,reference_locations=None, pull_image=True, rm_container=True, | ||
| rm_tmpdir=True, move_outputs="move", **kwargs): | ||
| # type: (bool, bool, bool, Text, **Any) -> None |
There was a problem hiding this comment.
likewise for this type signature as well
| 'prov == 1.5.1', | ||
| 'pathlib == 1.0.1', | ||
| 'graphviz == 0.8.2', | ||
| 'uuid == 1.30', |
There was a problem hiding this comment.
hmm.. this library might not be Python 3 compatible ..
There was a problem hiding this comment.
Yeah, not updated since 2007 :-P https://pypi.python.org/pypi/uuid
There was a problem hiding this comment.
It is a backport of the functionality within the Python 2.5+ standard library, so remove uuid from setup.py and requirements.txt and I bet many more of the tests will pass
There was a problem hiding this comment.
There was a problem hiding this comment.
Can we still use it even if removed from setup.py and requirement.txt?
There was a problem hiding this comment.
Yes, uuid is part of the Python Standard Library from Python 2.5 and onwards: https://docs.python.org/2/library/uuid.html
| 'schema-salad >= 2.6.20170927145003, < 3', | ||
| 'typing >= 3.5.3', | ||
| 'six >= 1.8.0', | ||
| 'prov == 1.5.1', |
There was a problem hiding this comment.
It does but there is a bug with datetime() and that might sometimes not record the start and end time of the activity and many more time instances used in quite a few properties.
In addition, if you want to make changes to prov serialization later to have a bundle instead of just one prov file (for example in case of sub-workflows), then prov 1.5.1 is better.
| 'typing >= 3.5.3', | ||
| 'six >= 1.8.0', | ||
| 'prov == 1.5.1', | ||
| 'pathlib == 1.0.1', |
There was a problem hiding this comment.
pathlib is deprecated, probably should use pathlib2
https://pypi.python.org/pypi/pathlib/
https://pypi.python.org/pypi/pathlib2/
| 'prov == 1.5.1', | ||
| 'pathlib == 1.0.1', | ||
| 'graphviz == 0.8.2', | ||
| 'pygraphviz == 1.3.1', |
There was a problem hiding this comment.
Are both needed? Only graphviz seems to be used
| 'pathlib == 1.0.1', | ||
| 'graphviz == 0.8.2', | ||
| 'pygraphviz == 1.3.1', | ||
| 'Matplotlib == 2.1.2', |
There was a problem hiding this comment.
This appears to be unused, can it be removed?
| 'graphviz == 0.8.2', | ||
| 'pygraphviz == 1.3.1', | ||
| 'Matplotlib == 2.1.2', | ||
| 'pydot == 1.2.4' |
There was a problem hiding this comment.
Likewise pydot doesn't appear to be used either.
| 'six >= 1.8.0', | ||
| 'prov == 1.5.1', | ||
| 'pathlib == 1.0.1', | ||
| 'graphviz == 0.8.2', |
There was a problem hiding this comment.
Is graphviz 0.8.1 sufficient? TravisCI in Python 3.3 mode can't see to find 0.8.2 https://travis-ci.org/common-workflow-language/cwltool/jobs/346298771#L521
There was a problem hiding this comment.
Like other modules, I tried updating this one too to use 0.8.1 instead but the workflow would not run if the version is changed. I am unsure about the underlying reason but can explore further.
There was a problem hiding this comment.
Also tried with 0.8 but same results.
| # This makes later close() a no-op | ||
| self.folder = None | ||
|
|
||
| def create_ro(tmpPrefix): |
There was a problem hiding this comment.
Now
def create_researchObject(tmpPrefix # type: str
):| return json.dumps(packed["$graph"][0], indent=4) | ||
|
|
||
|
|
||
| def generate_provDoc(): |
| if r.outdir: | ||
| self.output_dirs.add(r.outdir) | ||
| r.run(**kwargs) | ||
| if ro: |
There was a problem hiding this comment.
I would suggest creating a separate subclass of JobExecutor here to keep the API simpler and cleaner since the number of changes and if clauses for a single feature is large enough.
| document = ProvDocument() | ||
| engineUUID="" | ||
| activity_workflowRun={} # type: Dict[Text, Any] | ||
| defaultStreamHandler = logging.StreamHandler() |
There was a problem hiding this comment.
Consider reusing defaultStreamHandler from loghandler module
There was a problem hiding this comment.
Apparently I did not need it :). Thanks for indicating. removed in new commits.
| from ruamel.yaml.comments import CommentedMap, CommentedSeq | ||
| from schema_salad.sourceline import SourceLine, cmap | ||
|
|
||
| from .provenance import * |
There was a problem hiding this comment.
Consider removing this import
| # See ./cwltool/schemas/v1.0/Process.yml | ||
| hashmethod = hashlib.sha1 | ||
|
|
||
| class RO(): |
There was a problem hiding this comment.
I would suggest using longer names ResearchObject or research_obj instead of RO() and ro everywhere outside the module so they are more meaningful to unfamiliar code users.
There was a problem hiding this comment.
Thanks @anton-khodak for the feedback. Definitely makes sense. I'd make the required changes.
…ool into provenance
|
|
||
| if processStatus != "success": | ||
| _logger.warning(u"[job %s] completed %s", self.name, processStatus) | ||
| if research_obj: |
There was a problem hiding this comment.
Consider taking the inner blocks if research_obj: out of the if status != success: block to avoid code duplication.
There was a problem hiding this comment.
Thanks @psafont, good point. the new commit has resolved this.
|
The merged version does not write out the |
|
I ran this PR against the CWL conformance tests using Many tests passed; there are three types of problems so far |
make diff_pylint_reportis cleantoil-cwl-runner, does this break anything?--provenance is calledhasattr