-
Notifications
You must be signed in to change notification settings - Fork 664
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
Config parser (and loader) #4744
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Research updates:
|
Here's an example to illustrate how the config parser "executes" the config file. Given this config: foo.bar = 'hello'
foo {
bar = 'hello'
}
includeConfig 'foobar.config' The parser transforms this code into the following: assign(['foo', 'bar'], 'hello')
block('foo', {
assign(['bar'], 'hello')
}
includeConfig('foobar.config') Basically each statement is translated to a DSL method (see I think this is a good model for how we might separate the Nextflow language from the runtime. Instead of hooking directly into Groovy methods and relying on Groovy MOP, metaclass, etc, we can introduce a hidden DSL which allows us to better control how a given statement (e.g. invoking a process in a workflow) is executed by the runtime. |
Java security manager is being removed. I will keep an eye out for other sandboxing techniques, but in the meantime, a simple solution is to provide a "safe" execution mode where assignment expressions are wrapped in string literals. |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Really like the way that this is going, great work 👏🏻 |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
5a93547
to
27345a6
Compare
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: Ben Sherman <[email protected]>
@@ -739,6 +683,26 @@ class ConfigParserTest extends Specification { | |||
|
|||
} | |||
|
|||
def 'should apply profiles in the order they were defined' () { |
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.
@pditommaso this test is related to #1792 . We determined that config profiles are applied this way with the legacy parser. We could patch it, but I figure there's no point now, so just added a test to verify it's behavior.
Signed-off-by: Ben Sherman <[email protected]>
@pditommaso tests are passing, let's review and merge |
modules/nextflow/src/main/groovy/nextflow/config/ConfigParserFactory.groovy
Show resolved
Hide resolved
modules/nextflow/src/main/groovy/nextflow/config/parser/ConfigToGroovyVisitor.java
Show resolved
Hide resolved
@@ -14,14 +14,15 @@ | |||
* limitations under the License. | |||
*/ | |||
|
|||
package nextflow.config | |||
package nextflow.config.parser.legacy |
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.
it would be preferable to not shuffle stuff around and use Legacy
.
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 think this is a reasonable change to keep related classes organized. You have done a similar thing many times, e.g. nextflow.executor.local
or your proposed operator cleanup for the provenance tracking
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's fair, what I think it should be avoid the use of the term "legacy" in class or package names, as it's a bad practice to use the term "new" when introducing new class. It would be preferable just to use v1
for current ones and v2
for new ones.
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.
This could also allow the use of something like NXF_USE_SYNTAX_PARSER=v2
that's more extensible over NXF_ENABLE_STRICT_SYNTAX
(I still believe it may be convenient to decouple for the "strict" semantics that's the need in the short term).
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.
Consider keep current naming and use ConfigParserV2
for the new one
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.
ConfigParser
now refers to the shared interface which both parsers implement. That's why I had to rename them. I could call them ConfigParserV1
and ConfigParserV2
.
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
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.
One minor suggestion but otherwise the docs look great.
Co-authored-by: Chris Hakkaart <[email protected]> Signed-off-by: Ben Sherman <[email protected]>
Another flaky CI test:
|
Signed-off-by: Ben Sherman <[email protected]>
Close #2723
Implements the strict config syntax in Nextflow, using the shared "compiler" module from the language server.
To use the strict config syntax, simply set
NXF_ENABLE_STRICT_SYNTAX=true
in your environment when runningnextflow
.This config loader is much simpler and easier to read. There is no more dependence on metaclasses, instead there is a simple builder DSL for executing a config file and producing a map.
NOTE: While this PR uses Jitpack to load the shared module, this dependency should be inverted before the release of 25.04. That is, eventually the compiler module should reside in Nextflow and the language server should consume it.