-
Notifications
You must be signed in to change notification settings - Fork 736
Config parser (and loader) #4744
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
Conversation
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
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]>
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: Ben Sherman <[email protected]>
|
||
} | ||
|
||
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
modules/nextflow/src/main/groovy/nextflow/config/parser/legacy/ConfigBase.groovy
Outdated
Show resolved
Hide resolved
modules/nextflow/src/main/groovy/nextflow/config/parser/legacy/ConfigParserLegacy.groovy
Show resolved
Hide resolved
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]>
This comment was marked as resolved.
This comment was marked as resolved.
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: Paolo Di Tommaso <[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.
Awesome
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_SYNTAX_PARSER=v2
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.