Repository navigation
CWL to graph endpoint - #241
Conversation
|
This pull request introduces 1 alert when merging 11a2775 into 8df24dd - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging 6b910b6 into 8df24dd - view on LGTM.com new alerts:
|
mr-c
left a comment
There was a problem hiding this comment.
Tests in error:
CWLServiceTest.parseLobSTRDraft3WorkflowNative:124 » WorkflowNotFound
CWLServiceTest.parseLobSTRv1WorkflowNative:135 » WorkflowNotFound
|
This pull request introduces 1 alert when merging 1553779 into aaabd77 - view on LGTM.com new alerts:
|
kinow
left a comment
There was a problem hiding this comment.
Trying to run the tests locally (learning how to build the project & run tests using this PR 👍 ). Will see if I can pinpoint what's broken in the tests 🤓
|
|
||
| // Mock controller/MVC | ||
| CWLService mockCWLService = Mockito.mock(CWLService.class); | ||
| GraphVizService graphVizService = Mockito.mock(GraphVizService.class); |
kinow
left a comment
There was a problem hiding this comment.
Left two suggestions. One fixes the unit tests. The other fixes the endpoint when using curl.
After applying the two suggestions locally:
- all tests pass successfully
- I can successfully download an image using
curl, as shown below
curl -X POST -H "accept: image/png" -H "Content-Type: text/x-yaml" --data-binary @test.cwl http://localhost:7999/graph/png -o workflow.png
Where test.cwl has the contents of this workflow: https://raw.githubusercontent.com/common-workflow-language/cwlviewer/main/src/test/resources/cwl/lobstr-v1/lobSTR-workflow.cwl
And the output image is:
I noticed that I can use the Web UI to upload a CWL file that contains something that doesn't have a top level class attribute, or that has such attribute with a value like CommandLine. There is a button that lets me download the workflow as PNG or SVG.
However, these endpoints in this PR only allow for CWL files with a class: Workflow I think? Not a blocker IMO, thanks @stain !
| } | ||
| if (!found && ! packedWorkflowId.isEmpty()) throw new WorkflowNotFoundException(); | ||
| } | ||
| if (! found && extractProcess(cwlFile) != CWLProcess.WORKFLOW) { |
There was a problem hiding this comment.
@stain I think this is the cause of the two test failures pointed by @mr-c . The comment below says “Check the current json node is a workflow”. But the if statement here checks that extractProcess(cwlFile) (which returns a WORKFLOW for the lobstr file used in the failing test) is checking that the returned value is not a workflow?
Inverting it all the tests pass, and it matches your comment below.
| if (! found && extractProcess(cwlFile) != CWLProcess.WORKFLOW) { | |
| if (! found && extractProcess(cwlFile) == CWLProcess.WORKFLOW) { |
|
|
||
| private Resource getGraphFromInputStream(InputStream in, String format) | ||
| throws IOException, NoSuchAlgorithmException { | ||
| Workflow workflow = cwlService.parseWorkflowNative(in, "", "workflow"); // first workflow will do |
There was a problem hiding this comment.
@stain I think here packedWorkflowId needs to be null. Otherwise posting via curl results in Workflow not found, because the parseWorkflowNative will check if (packedWorkflowId != null) and will throw WorkflowNotFoundException since it couldn't locate the packed workflow.
| Workflow workflow = cwlService.parseWorkflowNative(in, "", "workflow"); // first workflow will do | |
| Workflow workflow = cwlService.parseWorkflowNative(in, null, "workflow"); // first workflow will do |
|
@kinow Thank you for your review and testing! I've sent you an invite to join https://github.com/orgs/common-workflow-language/teams/people/ ( check your email ) ; once you do that you can push commits directly to this branch. Would you please accept and implement your suggestions? |
Hi @mr-c ! I will gladly accept and join 🎉
Sure thing, will push the changes in a few minutes. Thanks! |
|
This pull request introduces 1 alert when merging 18e0ae1 into 2dd7df5 - view on LGTM.com new alerts:
|
18e0ae1 to
d0565ca
Compare
Sorry, forgot to update the mocked test. Edited my last commit updating the test too. In the meantime I'll test everything again locally with Let me know if you'd like me to try to rebase this PR too @mr-c 👍 |
|
Tests passed, |
|
This pull request introduces 1 alert when merging d0565ca into 2dd7df5 - view on LGTM.com new alerts:
|
|
@kinow Feel free to clean up the git history, yes please. Any thoughts about https://github.com/common-workflow-language/cwlviewer/pull/241/files#annotation_2003129099 ? |
.. basically NOT application/json because it would probably mean they got it wrong
d0565ca to
f5e751d
Compare
Rebased without - hopefully - messing up the history. Kept all commits in this branch, just had to update where a method was now using
IMO that issue is correct in point that there is a risk of serializing user input directly. We could either sandbox it (Jenkins does something like that with XML/XStream), or try using a library that handles that. But that would probably be in a follow-up issue/pull request I think. It looks like this issue is being raised in a part of the file that was not changed in this PR? (sorry, not too familiar with code base yet) |
|
This pull request introduces 1 alert when merging f5e751d into 2502986 - view on LGTM.com new alerts:
|
Well, now we push data directly from HTTP into YAML deserialization; where as before the data only came from Git clones (but also untrusted data). So I guess it should be a separate, but important, issue. Can you open that? |
Yup, you are correct. Just had a look at the Sorry, I thought that was already the case for that other option that downloads SVG & PNG 😳
Agreed! Will open the issue and link to this PR 👍 |
|
This pull request introduces 1 alert when merging d75eff1 into 2502986 - view on LGTM.com new alerts:
|

Description
Adds REST resources to directly make PNG or SVG of individual CWL file
POSTed.This replaces #239 by merging in #240 to avoid temporary files.
Motivation and Context
Some workflows may need to be roughly visualized even if they are not in a git repository. The native CWL parser in CWL Viewer usually gives a "good enough" diagram when further details are not needed (e.g. labels), and is faster than having to
git clonepotentially large repository.How Has This Been Tested?
Tested as part of SEEK workflow branch.
Types of changes
Checklist: