Skip to content
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

clusterOptions does not work with CLI flags (LSF executor) #4935

Closed
timini opened this issue Apr 19, 2024 · 3 comments · Fixed by #4993
Closed

clusterOptions does not work with CLI flags (LSF executor) #4935

timini opened this issue Apr 19, 2024 · 3 comments · Fixed by #4993
Milestone

Comments

@timini
Copy link

timini commented Apr 19, 2024

Bug report

when specigying a clusterOptions which includes a flag the Grid executor header is constructed wrongly by nextflow

e.g profile.config :

clusterOptions = { "-g /${_queue_group} -app ${params.fast_track ? params.lsf_fast_track_profile : task.process.tokenize(':')[-1].toLowerCase()} -sp ${params.hpc_priority} -P ${params.lsf_project_name} -rn" }

results in the following BSUB command (LSF executor)

#!/bin/bash
#BSUB -o /home/tim/nextflow/13/e0aeb3d2121ed180dc3272e28de8a0/.command.log
#BSUB -q high
#BSUB -W 24:00
#BSUB -J nf-DELIVERY_INTEGRITY_MOVE_DELIVERY_(HX23697398_LP5221738-DNA_H07)
#BSUB -rn -g
#BSUB /high -app
# NEXTFLOW TASK: DELIVERY_INTEGRITY:MOVE_DELIVERY (HX23697398/LP5221738-DNA_H07)
set -e
set -u
NXF_DEBUG=${NXF_DEBUG:=0}; [[ $NXF_DEBUG > 1 ]] && set -x
NXF_ENTRY=${1:-nxf_main}

Expected behavior and actual behavior

I would expect flags (keys with no values) to be correctly rendered in the BSUB option lists

#!/bin/bash
#BSUB -o /home/tim/nextflow/13/e0aeb3d2121ed180dc3272e28de8a0/.command.log
#BSUB -q high
#BSUB -W 24:00
#BSUB -J nf-DELIVERY_INTEGRITY_MOVE_DELIVERY_(HX23697398_LP5221738-DNA_H07)
#BSUB -rn 
#BSUB -g /high
#BSUB  -app something
# NEXTFLOW TASK: DELIVERY_INTEGRITY:MOVE_DELIVERY (HX23697398/LP5221738-DNA_H07)
set -e
set -u
NXF_DEBUG=${NXF_DEBUG:=0}; [[ $NXF_DEBUG > 1 ]] && set -x
NXF_ENTRY=${1:-nxf_main}

Steps to reproduce the problem

(Provide a test case that reproduce the problem either with a self-contained script or GitHub repository)

Program output

(Copy and paste here output produced by the failing execution. Please highlight it as a code block. Whenever possible upload the .nextflow.log file.)

Environment

  • Nextflow version: [?]
  • Java version: [?]
  • Operating system: [macOS, Linux, etc]
  • Bash version: (use the command $SHELL --version)

Additional context

(Add any other context about the problem here)

@bentsherman
Copy link
Member

It is because the abstract grid executor assumes the cluster options are provided as key-value pairs:

String getHeaders( TaskRun task ) {
final token = getHeaderToken()
def result = new StringBuilder()
def header = new ArrayList(2)
def dir = getDirectives(task)
def len = dir.size()-1
for( int i=0; i<len; i+=2) {
def opt = dir[i]
def val = dir[i+1]
if( opt ) header.add(opt)
if( val ) header.add(wrapHeader(val))
if( header ) {
result << token << ' ' << header.join(' ') << '\n'
}
header.clear()
}
return result.toString()
}

So you can probably make clusterOptions work by inserting a blank value after -rn:

clusterOptions = { "-g /${_queue_group} -app ${params.fast_track ? params.lsf_fast_track_profile : task.process.tokenize(':')[-1].toLowerCase()} -sp ${params.hpc_priority} -P ${params.lsf_project_name} -rn ''" }

@bentsherman
Copy link
Member

@pditommaso what if we allow clusterOptions to be a list of strings, then it becomes clear how to map the options to the directive lines:

clusterOptions = { [
  "-g /${_queue_group}",
  "-app ${params.fast_track ? params.lsf_fast_track_profile : task.process.tokenize(':')[-1].toLowerCase()}",
  "-sp ${params.hpc_priority}",
  "-P ${params.lsf_project_name}",
  "-rn" ] }

@pditommaso
Copy link
Member

It makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants