nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Process with Docker enabled wrongly parses .command.sh

Open xsvato01 opened this issue 4 months ago • 0 comments

Bug report

I observed unusual behavior in Nextflow with Docker enabled, despite the .command.sh file appearing correct:

#!/bin/bash -eo pipefail
bcl2fastq 	--runfolder-dir bclFolder 	--processing-threads 8 	--output-dir output 	--sample-sheet bclFolder/SampleSheet.csv 	--no-lane-splitting 	--ignore-missing-bcls

The actual task exits with non-zero status:

Command executed:

  bcl2fastq e-sp--runfolder-dir bclFolder       --processing-threads 8 f--output-dir output     --sample-sheet bclFolder/SampleSheet.csv        --no-lane-splitting     --ignore-missing-bcls

Command exit status:
  1

Notice the strange characters that were used in the command, that are missing from the actual .command.sh

Expected behavior and actual behavior

Interestingly, the process works seamlessly with Conda or Aptainer. I tested several containers featuring the same tool, but they all encountered the same error. Additionally, I tried to format the command as a single line, but the error still occurs - in the code it looks like following:

	script:
	"""
	bcl2fastq \
		--runfolder-dir $bclFolder \
		--processing-threads $task.cpus \
		--output-dir output \
		--sample-sheet ${bclFolder}/SampleSheet.csv \
		--no-lane-splitting \
		--ignore-missing-bcls
	"""	

Program output

Oct-17 15:37:26.617 [main] DEBUG nextflow.cli.Launcher - $> nextflow run main.nf -resume -with-report --home /home/jan/Nextflow_scripts/PGTL -process.echo
Oct-17 15:37:26.722 [main] DEBUG nextflow.cli.CmdRun - N E X T F L O W  ~  version 24.04.4
Oct-17 15:37:26.740 [main] DEBUG nextflow.plugin.PluginsFacade - Setting up plugin manager > mode=prod; embedded=false; plugins-dir=/home/jan/.nextflow/plugins; core-plugins: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
Oct-17 15:37:26.751 [main] INFO  o.pf4j.DefaultPluginStatusProvider - Enabled plugins: []
Oct-17 15:37:26.752 [main] INFO  o.pf4j.DefaultPluginStatusProvider - Disabled plugins: []
Oct-17 15:37:26.754 [main] INFO  org.pf4j.DefaultPluginManager - PF4J version 3.12.0 in 'deployment' mode
Oct-17 15:37:26.764 [main] INFO  org.pf4j.AbstractPluginManager - No plugins
Oct-17 15:37:26.784 [main] DEBUG nextflow.config.ConfigBuilder - Found config local: /home/jan/Nextflow_scripts/PGTL/nextflow.config
Oct-17 15:37:26.787 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /home/jan/Nextflow_scripts/PGTL/nextflow.config
Oct-17 15:37:26.808 [main] DEBUG n.secret.LocalSecretsProvider - Secrets store: /home/jan/.nextflow/secrets/store.json
Oct-17 15:37:26.810 [main] DEBUG nextflow.secret.SecretsLoader - Discovered secrets providers: [nextflow.secret.LocalSecretsProvider@6eafb10e] - activable => nextflow.secret.LocalSecretsProvider@6eafb10e
Oct-17 15:37:26.822 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard`
Oct-17 15:37:27.408 [main] DEBUG nextflow.cli.CmdRun - Applied DSL=2 by global default
Oct-17 15:37:27.420 [main] DEBUG nextflow.cli.CmdRun - Launching `main.nf` [deadly_coulomb] DSL2 - revision: 51309fa892
Oct-17 15:37:27.421 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins default=[]
Oct-17 15:37:27.422 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins resolved requirement=[]
Oct-17 15:37:27.472 [main] DEBUG nextflow.Session - Session UUID: 64dd80c7-f856-4d59-bdea-5b7e2d7b0244
Oct-17 15:37:27.472 [main] DEBUG nextflow.Session - Run name: deadly_coulomb
Oct-17 15:37:27.472 [main] DEBUG nextflow.Session - Executor pool size: 12
Oct-17 15:37:27.480 [main] DEBUG nextflow.file.FilePorter - File porter settings maxRetries=3; maxTransfers=50; pollTimeout=null
Oct-17 15:37:27.486 [main] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'FileTransfer' minSize=10; maxSize=36; workQueue=LinkedBlockingQueue[10000]; allowCoreThreadTimeout=false
Oct-17 15:37:27.502 [main] DEBUG nextflow.cli.CmdRun - 
  Version: 24.04.4 build 5917
  Created: 01-08-2024 07:05 UTC (09:05 CEST)
  System: Linux 6.8.0-47-generic
  Runtime: Groovy 4.0.21 on OpenJDK 64-Bit Server VM 17.0.10+7
  Encoding: UTF-8 (UTF-8)
  Process: 9521@jan-gnt [127.0.1.1]
  CPUs: 12 - Mem: 62.6 GB (53.8 GB) - Swap: 2 GB (2 GB)
Oct-17 15:37:27.534 [main] DEBUG nextflow.Session - Work-dir: /home/jan/Nextflow_scripts/PGTL/work [ext2/ext3]
Oct-17 15:37:27.534 [main] DEBUG nextflow.Session - Script base path does not exist or is not a directory: /home/jan/Nextflow_scripts/PGTL/bin
Oct-17 15:37:27.542 [main] DEBUG nextflow.executor.ExecutorFactory - Extension executors providers=[]
Oct-17 15:37:27.550 [main] DEBUG nextflow.Session - Observer factory: DefaultObserverFactory
Oct-17 15:37:27.576 [main] DEBUG nextflow.cache.CacheFactory - Using Nextflow cache factory: nextflow.cache.DefaultCacheFactory
Oct-17 15:37:27.584 [main] DEBUG nextflow.util.CustomThreadPool - Creating default thread pool > poolSize: 13; maxThreads: 1000
Oct-17 15:37:27.829 [main] DEBUG nextflow.Session - Session start
Oct-17 15:37:28.107 [main] DEBUG nextflow.script.ScriptRunner - > Launching execution
Oct-17 15:37:28.569 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:xl_mem` matches labels `l_cpu,xl_mem` for process with name Bcl2FastQ
Oct-17 15:37:28.570 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:l_cpu` matches labels `l_cpu,xl_mem` for process with name Bcl2FastQ
Oct-17 15:37:28.580 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Oct-17 15:37:28.581 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Oct-17 15:37:28.586 [main] DEBUG nextflow.executor.Executor - [warm up] executor > local
Oct-17 15:37:28.590 [main] DEBUG n.processor.LocalPollingMonitor - Creating local task monitor for executor 'local' > cpus=12; memory=62.6 GB; capacity=12; pollInterval=100ms; dumpInterval=5m
Oct-17 15:37:28.592 [main] DEBUG n.processor.TaskPollingMonitor - >>> barrier register (monitor: local)
Oct-17 15:37:28.693 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:s_mem` matches labels `m_cpu,s_mem` for process with name AlignBams
Oct-17 15:37:28.694 [main] DEBUG nextflow.script.ProcessConfig - Config settings `withLabel:m_cpu` matches labels `m_cpu,s_mem` for process with name AlignBams
Oct-17 15:37:28.700 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Oct-17 15:37:28.700 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Oct-17 15:37:28.704 [main] DEBUG nextflow.Session - Workflow process names [dsl2]: AlignBams, MultiQC, Bcl2FastQ, MarkDuplicates, FastQC, BamQC
Oct-17 15:37:28.705 [main] DEBUG nextflow.Session - Igniting dataflow network (3)
Oct-17 15:37:28.709 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > Bcl2FastQ
Oct-17 15:37:28.710 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > AlignBams
Oct-17 15:37:28.711 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files:
  Script_047f6a79a193c16a: /home/jan/Nextflow_scripts/PGTL/main.nf
  Script_686c2c83e80e9929: /home/jan/Nextflow_scripts/PGTL/./modules/secondary.nf
  Script_54d354e16e54c323: /home/jan/Nextflow_scripts/PGTL/./subworkflows/QualityControl.nf
  Script_636a6f92e2277214: /home/jan/Nextflow_scripts/PGTL/./subworkflows/../modules/qc.nf
Oct-17 15:37:28.711 [main] DEBUG nextflow.script.ScriptRunner - > Awaiting termination 
Oct-17 15:37:28.711 [main] DEBUG nextflow.Session - Session await
Oct-17 15:37:28.922 [Task submitter] DEBUG n.executor.local.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Oct-17 15:37:28.923 [Task submitter] INFO  nextflow.Session - [d2/588ce3] Submitted process > Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB)
Oct-17 15:37:32.037 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 1; name: Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB); status: COMPLETED; exit: 1; error: -; workDir: /home/jan/Nextflow_scripts/PGTL/work/d2/588ce3c7a9aacaee7635ff3318189b]
Oct-17 15:37:32.038 [Task monitor] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'TaskFinalizer' minSize=10; maxSize=36; workQueue=LinkedBlockingQueue[10000]; allowCoreThreadTimeout=false
Oct-17 15:37:32.043 [TaskFinalizer-1] DEBUG nextflow.processor.TaskProcessor - Handling unexpected condition for
  task: name=Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB); work-dir=/home/jan/Nextflow_scripts/PGTL/work/d2/588ce3c7a9aacaee7635ff3318189b
  error [nextflow.exception.ProcessFailedException]: Process `Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB)` terminated with an error exit status (1)
Oct-17 15:37:32.061 [TaskFinalizer-1] ERROR nextflow.processor.TaskProcessor - Error executing process > 'Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB)'

Caused by:
  Process `Bcl2FastQ (Bcl2FastQ using 8 CPUs 12 GB)` terminated with an error exit status (1)


Command executed:

  bcl2fastq             --runfolder-dir bclFolder               --processing-threads 8          --output-dir output             --sample-sheet bclFolder/SampleSheet.csv                --no-lane-splitting          --ignore-missing-bcls

Command exit status:
  1

Command output:
  (empty)

Command error:
                                                     * to select tile 2 in lane 1
                                                    and all the tiles in the 
                                                    other lanes:
                                                         --tiles s_1_0002,s_[2-8]
    --minimum-trimmed-read-length arg (=35)         minimum read length after 
                                                    adapter trimming
    --use-bases-mask arg                            specifies how to use each 
                                                    cycle.
    --mask-short-adapter-reads arg (=22)            smallest number of remaining 
                                                    bases (after masking bases 
                                                    below the minimum trimmed 
                                                    read length) below which 
                                                    whole read is masked
    --adapter-stringency arg (=0.9)                 adapter stringency
    --ignore-missing-bcls                           assume 'N'/'#' for missing 
                                                    calls
    --ignore-missing-filter                         assume 'true' for missing 
                                                    filters
    --ignore-missing-positions                      assume [0,i] for missing 
                                                    positions, where i is 
                                                    incremented starting from 0
    --ignore-missing-controls                       (deprecated) assume 0 for 
                                                    missing controls
    --write-fastq-reverse-complement                generate FASTQs containing 
                                                    reverse complements of actual
                                                    data
    --with-failed-reads                             include non-PF clusters
    --create-fastq-for-index-reads                  create FASTQ files also for 
                                                    index reads
    --find-adapters-with-sliding-window             find adapters with simple 
                                                    sliding window algorithm
    --no-bgzf-compression                           turn off BGZF compression for
                                                    FASTQ files
    --fastq-compression-level arg (=4)              zlib compression level (1-9) 
                                                    used for FASTQ files
    --barcode-mismatches arg (=1)                   number of allowed mismatches 
                                                    per index
                                                    Multiple, comma delimited, 
                                                    entries allowed. Each entry 
                                                    is applied to the 
                                                    corresponding index; last 
                                                    entry applies to all 
                                                    remaining indices.
                                                    Accepted values: 0, 1, 2.
    --no-lane-splitting                             do not split fastq files by 
                                                    lane.
  
  
  
  Failed to parse the options: too many positional options have been specified on the command line

Work dir:
  /home/jan/Nextflow_scripts/PGTL/work/d2/588ce3c7a9aacaee7635ff3318189b

Tip: you can replicate the issue by changing to the process work dir and entering the command `bash .command.run`
Oct-17 15:37:32.068 [main] DEBUG nextflow.Session - Session await > all processes finished
Oct-17 15:37:32.077 [TaskFinalizer-1] INFO  nextflow.Session - Execution cancelled -- Finishing pending tasks before exit
Oct-17 15:37:32.080 [Task monitor] DEBUG n.processor.TaskPollingMonitor - <<< barrier arrives (monitor: local) - terminating tasks monitor poll loop
Oct-17 15:37:32.081 [main] DEBUG nextflow.Session - Session await > all barriers passed
Oct-17 15:37:32.083 [main] DEBUG nextflow.util.ThreadPoolManager - Thread pool 'TaskFinalizer' shutdown completed (hard=false)
Oct-17 15:37:32.091 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=1; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=24.3s; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=1; peakCpus=8; peakMemory=12 GB; ]
Oct-17 15:37:32.091 [main] DEBUG nextflow.trace.ReportObserver - Workflow completed -- rendering execution report
Oct-17 15:37:32.686 [main] DEBUG nextflow.cache.CacheDB - Closing CacheDB done
Oct-17 15:37:32.701 [main] DEBUG nextflow.util.ThreadPoolManager - Thread pool 'FileTransfer' shutdown completed (hard=false)
Oct-17 15:37:32.701 [main] DEBUG nextflow.script.ScriptRunner - > Execution complete -- Goodbye

The incorrect parsing is evident when the process fails and displays the error in the console, whereas the .nextflow.log file does not show any discrepancies.

Environment

  • Nextflow version: 24.04.4.5917
  • Java version: openjdk 17.0.10 2024-01-16
  • Operating system: Linux
  • Bash version: 5.1.16(1)-release (x86_64-pc-linux-gnu)

xsvato01 avatar Oct 17 '24 13:10 xsvato01