Process execution fails with not GNU version of sleep and date tools
Hello,
I routinely use Nextflow with Docker containers, but when I tried using mulled Docker containers from Biocontainers (https://github.com/BioContainers/mulled) I get an error:
sleep: invalid number '0.1'
work/a1/8bca31207930d54c30ce0d03673db5/.command.run.1: line 103: 1492460951%3N: value too great for base (error token is "3N")
I noticed that the sleep utility version from the Biocontainers base image is from BusyBox and does not support fractional sleep arguments, hence sleep 0.1 fails.
Thank you Roberto
I've just tried and sleep it's working fine with decimal numbers:
docker run busybox:latest sleep 0.1
However I big issue is that busybox does not include bash that is required to use NF.
Thanks for the quick reply!
Here are the steps to reproduce what I am seeing. For this example, I am using the samtools Biocontainer hosted on Quay, so that I have a tool to play with and verify that the container works when called from the command line.
Checking that samtools works from this container:
>docker run --rm -it quay.io/biocontainers/samtools:1.4--0 samtools view
Usage: samtools view [options] <in.bam>|<in.sam>|<in.cram> [region ...]
Options:
-b output BAM
-C output CRAM (requires -T)
-1 use fast BAM compression (implies -b)
[output truncated]
Checking sleep and bash:
>docker run --rm -it quay.io/biocontainers/samtools:1.4--0
/ # sleep
BusyBox v1.22.1 (2014-05-23 01:24:27 UTC) multi-call binary.
Usage: sleep N
Pause for N seconds
/ # sleep 1
/ # sleep 0.1
sleep: invalid number '0.1'
/ # uname -a
Linux 8b0f55930bac 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 GNU/Linux
/ # /bin/bash
bash-4.2#
I think it's possible to fallback on sleep 1 when decimal is not supported. In the meanwhile a workaround is to disable the trace-file and/or timeline report features (which requires that sleep command).
I've uploaded a new snapshot that should solve this problem. You can try by using the following command:
NXF_VER=0.24.3-SNAPSHOT nextflow run .. etc
Thank you Paolo, this fixes the sleep error. I am now left only with the second error message reported:
work/07/7f1aa5f881a74e5a2946d908b133e1/.command.run.1: line 103: 1492531526%3N: value too great for base (error token is "3N")
The error is always the same for different containers/tools (all coming from the Biocontainers project), and even the number 1492531526%3N is identical.
I think now the problem is this the date tool
https://github.com/nextflow-io/nextflow/blob/master/src/main/groovy/nextflow/executor/BashWrapperBuilder.groovy#L191-191
Not sure it makes sense such old toolset. I quicker workaround is to disable both trace-file and/or timeline feature during your pipeline execution
I confirm that disabling trace and timeline works. For myself, I can use this workaround, but I wonder whether Biocontainers will become widespread enough to make their full support desirable. To me Biocontainers are a very appealing source of ready-to-go Docker containers, and because they tap from Homebrew/Bioconda recipes, it seems they won't have any rival in terms of size of the repository and tool availability. An update to their base image would do, but from their point of view the containers work, so not sure they would be willing to do that. Plus, such a change may not be retroactive for the thousands of containers already in the registry to date. That is why I thought that attacking the issue from the Nextflow side would yield more chances of success.
Could you try to the following: change in the directory of a failing task; edit the .command.run.1 script and replace the following line
*) echo 'date +%s%3N';;
with:
*) echo 'date +%s%3N 2>/dev/null || date +%s000';;
Then run the task with bash .command.run
Let me know if it runs fine.
I get this error from BusyBox' date:
BusyBox v1.22.1 (2014-05-23 01:24:27 UTC) multi-call binary.
Usage: date [OPTIONS] [+FMT] [TIME]
Display time (using +FMT), or set time
[-s,--set] TIME Set time to TIME
-u,--utc Work in UTC (don't convert to local time)
-R,--rfc-2822 Output RFC-2822 compliant date string
-I[SPEC] Output ISO-8601 compliant date string
SPEC='date' (default) for date only,
'hours', 'minutes', or 'seconds' for date and
time to the indicated precision
-r,--reference FILE Display last modification time of FILE
-d,--date TIME Display TIME, not 'now'
-D FMT Use FMT for -d TIME conversion
Recognized TIME formats:
hh:mm[:ss]
[YYYY.]MM.DD-hh:mm[:ss]
YYYY-MM-DD hh:mm[:ss]
[[[[[YY]YY]MM]DD]hh]mm[.ss]
'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead
I've package another snapshot that should solve the problem. Please do the following to test it:
Refresh your version with this command:
NXF_VER=0.24.3-SNAPSHOT CAPSULE_RESTE nextflow info
It should print
Version: 0.24.3-SNAPSHOT build 4306
Modified: 18-04-2017 20:26 UTC (22:26 CEST)
Then you can use it as before:
NXF_VER=0.24.3-SNAPSHOT nextflow run .. etc
This works, thank you Paolo!
Released with version 0.24.3.