-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implemented funtionality to support scatter, loops, conditionals and call sorting #3
Conversation
@daniilsavchuk thanks a lot, this is great! One remark from my side: @daniilsavchuk could you please update http://pb.opensource.epam.com/ demo application once this PR is merged? |
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.
Great job. However, I think a few changes should be made before accepting the PR.
@@ -123,7 +196,7 @@ describe('parser/WDL/entities/WDLWorkflow', () => { | |||
})).to.throws(WDLParserError); | |||
}); | |||
|
|||
it('throws error when workflow uses scatter', () => { | |||
it('requires scatter', () => { |
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.
Did you really mean requires scatter/while/if or supports / knows / understands / whatever?
README.md
Outdated
* [Loop](https://github.com/broadinstitute/wdl/blob/develop/SPEC.md#loops) - IN DEVELOPMENT | ||
* [Workflow level resolution](https://github.com/broadinstitute/wdl/blob/develop/SPEC.md#workflow-level-resolution) | ||
* [Order when generating declarations of any step(workflow, call, if, scatter, while and task)](https://github.com/broadinstitute/wdl/blob/develop/SPEC.md#workflow-level-resolution) | ||
* [Declarations into the [call, if, scatter and while] blocks are not supported](https://github.com/broadinstitute/wdl/blob/develop/SPEC.md#conditionals) |
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.
- Could you reformulate these long titles, please? I am unable to understand the first one completely.
- I'm not a meanie, you know, but: into the -> in a / inside a
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.
Thank you very much for this note!
Would it be suitable to write:
"Order of steps (workflow, call, if, scatter, while) in generated WDL code" for the first case?
(It is placed in the limitation paragraph)
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.
Thank you!
Done in afde1ce commit
src/model/Group.js
Outdated
/* Override the parent function to prohibit the port addition*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
_onActionChanged() { | ||
} |
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.
Does this code really prevents port addition? I think, an Action will still hold new ports but they will be out of sync with the Step. That's not good.
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.
Thank you!
Done in 14ae69c commit
scatter: this.genScatter, | ||
whileloop: this.genWhile, | ||
if: this.genIf, | ||
}; |
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.
What is the justification for the whileloop
name? You've used if
and scatter
but not while
. Consider changing the 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.
Thank you so much for deep analysis of my changes, it is really helpfull for me to get so detailed review!
This name threated by this way because hermes\wdl_parser.js named this so.
Please look at the endings of the grammar rules listed below: (there are names the same to my processor names mapping array)
grammar.hgr
$while_loop = :while :lparen $e :rparen :lbrace list($wf_body_element) :rbrace -> WhileLoop(expression=$2, body=$5)
$if_stmt = :if :lparen $e :rparen :lbrace list($wf_body_element) :rbrace -> If(expression=$2, body=$5)
$scatter = :scatter :lparen :identifier :in $e :rparen :lbrace list($wf_body_element) :rbrace
-> Scatter(item=$2, collection=$4, body=$7)
If this conduct could not be a reason of some issues related to this naming, please let me to leave it.
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.
You converted if_stmt
-> if
, but while_loop
-> whileloop
... I still don't see the logic. I wish you would keep names clear and concise, no matter how ugly and complicated they are in hermes grammar =) Ok, go on, if you are sure.
|
||
it('throws error when try to create with ports', () => { | ||
expect(() => new Group(name, type, config)).to.throw(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 a port creation disabled in such Actions? A user can create without ports and add them later. You removed a test which (incorrectly) asserts on _onActionChanged()
but didn't add a correct test for the case I mention.
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.
Thank you!
Done in 14ae69c commit
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.
Probably the reference is broken.
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.
Well done. Everything is almost fine. Nevertheless, I found several issues that I believe have to be resolved prior to the merge.
} | ||
|
||
return `${res}${EOL}`; | ||
} |
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 it worth trying to add all strings into array and then just join them with EOL separator? It applies to this particular case as well as to the overall routine.
To be honest, I don't think this is a major issue, but I would like you to consider this oppotunity too.
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.
Thank you so it is a one more great thing done by your review!
It is special case for call generating function because it could be leaded by different way (it could have the "input mapping block" or could not) and so it is impossible to place ${EOL} by way you recommened.
Let me leave it if you do not mindly?
src/visual/VisualGroup.js
Outdated
* @private | ||
*/ | ||
export default class VisualGroup extends joint.shapes.devs.Model { | ||
constructor(step, opts = {}) { |
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.
Why does this class inherits joint Model instead of the VisualStep
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.
Thank you very much for your valuable review it is making development cleaner!
In this case I did not use the inheritance because in my opinion it is not necessary, so the both classes are doing different (not at all, them looks like to be inherited but it could be a reason of additional problems related to styles, updates, and bbox functions).
If you do not mind I'll leave them both inherited from joint.shapes.devs.Model
src/visual/VisualGroup.js
Outdated
}, | ||
}, | ||
type: 'VisualStep', | ||
}); |
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.
Please, check if it is OK to have two different Model classes with the same type 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.
Thank you!
Done in 1b537c9 commit
|
||
expect(parse(src).status).to.equal(false); | ||
}); | ||
|
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.
Test name says that this code throws something, but there is no check that it actually does it.
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.
Thank you!
Done in afde1ce commit
src/visual/Visualizer.js
Outdated
bottom: 50, | ||
}, | ||
}); | ||
} |
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 it wrong to move this code to VisualGroup's update method?
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.
Thank you, very strong and trully note, I followed it!
Done in d47a5df commit
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.
Great job! Now everything is fine by me.
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.
Ok, thanks.
General idea
This Pull Request introduces support for Scatter, Loop and Conditionals syntax. These features are widely used in WDL scripts hosted on the Broad Institute FireCloud service, so it seems that visualization and generation of such constructions is a must
Examples of WDL visualizations are listed below
Conditionals
WDL Specification: Conditionals
Code example:
Visual representation:
Scatter
WDL Specification: Scatter
Code example:
Visual:
Loop
WDL Specification: Loops
Code example:
Visual:
Calls sorting
According to WDL specification it is necessary to sort the calls during the generation in case of order calls should be executed
Changes
Added
Changed