-
Notifications
You must be signed in to change notification settings - Fork 192
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
Time parameters like 4.d
get parsed as double and fail schema validation
#858
Comments
Some testing confirmed that it is indeed not caught by the Adding if (p['value'].getClass() == Double) {
new_params.replace(p.key, p['value'].toString())
} To that function captures the parameter, but converts it to |
Catching the double and then appending the Given that you can just specify e.g. 72.h instead of 3.d we can live without the day version, but the error message might not be very clear to the user unfortunately. |
Did we solve this by changing how we specify dates in the end? |
We might have ... wanted to spend some quality time with this issue during the hackathon. |
Is this fixed by #974 ? |
Nope: $ nextflow run nf-core-testpipeline/ -profile test,docker --max_time 4.d
N E X T F L O W ~ version 21.03.0-edge
Launching `nf-core-testpipelinee/main.nf` [nauseous_visvesvaraya] - revision: de1773e09a
------------------------------------------------------
,--./,-.
___ __ __ __ ___ /,-._.--~'
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/testpipelinee v1.0dev
------------------------------------------------------
ERROR: Validation of pipeline parameters failed!
* --max_time: expected type: String, found: Double (4.0)
|
I don't totally understand why |
Ah thanks for reminding me, need to have a closer look at this ... I think it's because of the |
We could probably use the hack from above: if (p['value'].getClass() == Double) {
new_params.replace(p.key, p['value'].toString())
} and fix the the resulting string to pass validation. This is as hacky as it gets though ... :/ |
Okay we can catch the parameter internally, fix it so it looks like a proper duration ("4.d") but then it still fails because it's already parsed as double internally and sets to run time limit to a rather short 4ms ... It get's converted to It works when setting the parameter in |
@pditommaso have you seen this before? Nextflow time objects with days being parsed as a numeric double instead? Sounds like it may be something that should be fixed upstream @KevinMenden.. |
I think it conflicts with 'd' literal for double https://stackoverflow.com/a/27368444/395921. Also try to avoid hacks like the following, looks very bad if (p['value'].getClass() == Double) {
new_params.replace(p.key, p['value'].toString())
} |
Okay thanks - so then there's really nothing we can do here, except adapting the regex and use Yes we're not using that, it doesn't really work anyway :) Although we use similar hacks to deal with the nextflow duration objects etc 👀 need to remove them before passing the object to the Schema validator |
I didn't know about |
@pditommaso we just implemented this but ran into a problem - if a Nextflow config file uses a native memory variable type then Nextflow will automatically simplify this and uses the params.some_time = 48.h
println(params.some_time) $ nextflow run mem_test.nf
N E X T F L O W ~ version 21.03.0-edge
Launching `mem_test.nf` [condescending_panini] - revision: 18bf7ca334
2d So then we're kind of screwed as this then hits the string double parsing issue we see above. But there's nothing that we can do about it.. Is it possible to get Nextflow to use |
@KevinMenden @drpatelh - can this issue be closed now? |
Description of the bug
Using e.g.
--max_time 4.d
throws a validation exception because the schema expects a string for--max_time
which should be granted by internal conversion of nextflow Duration objects to string, which seems to fail in this case
Steps to reproduce
Running a pipeline with the new parameter validation and a time parameter as described above should reproduce the bug.
I did it with a fresh template.
The text was updated successfully, but these errors were encountered: