nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.79k stars 633 forks source link

No project name was specified #3559

Open nick-youngblut opened 1 year ago

nick-youngblut commented 1 year ago

Bug report

If one runs nextflow run with -with-report or -with-trace (and provides a "main" nextflow workflow file as input, such as main.nf), then one gets the error:

No project name was specified

There is no info in https://www.nextflow.io/docs/latest/tracing.html that I can find on how to set the project name. I have tried to set the project name via:

manifest {
  name = 'my_project_name'
}

...but that still results in the issue.

Expected behavior and actual behavior

Clear information on how to set the project name when using -with-report or -with-trace.

Steps to reproduce the problem

Nextflow version: 22.10.4.5836

Installed Nextflow via bioconda

Run

nextflow run  -profile aws,docker -with-trace -with-report main.nf 

Config

manifest {
  name = 'my_project_name'
}

profiles {
    docker {
        docker.enabled         = true
        docker.sudo            = true
        docker.runOptions      = '-u \$(id -u):\$(id -g)'
        singularity.enabled    = false
        podman.enabled         = false
        shifter.enabled        = false
        charliecloud.enabled   = false
    }
    aws {
        process.executor   = 'awsbatch'
        process.queue      = 'my_process_queue'
    }
}

aws {
  batch.cliPath = '/home/ec2-user/miniconda/bin/aws'
  accessKey = secrets.AWS_ACCESS_KEY_ID
  secretKey = secrets.AWS_SECRET_ACCESS_KEY
  region = secrets.AWS_DEFAULT_REGION
}

process {
    errorStrategy = 'retry'
    maxRetries    = 3
    maxErrors     = '-1'
}

Environment

Maybe it would be useful to create a nextflow diagnose subcommand that lists all of these environment parameters?

mribeirodantas commented 1 year ago

Hm.. If you place the main.nf right after run it works, but when it's at the end it doesn't. Yeah, definitely looks like a bug!

bentsherman commented 1 year ago

Looks like the run command just expects the project name to be the first argument:

https://github.com/nextflow-io/nextflow/blob/41510e874644af8fe8986f04fa5bad20bb9a430f/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy#L279-L283

maxulysse commented 1 year ago

also, using -with-report main.nf means that you want the pipeline to create the report main.nf. cf https://www.nextflow.io/docs/latest/tracing.html#execution-report

mribeirodantas commented 1 year ago

Good point, @maxulysse !

bentsherman commented 1 year ago

I think this is the expected behavior. Not just with Nextflow but with CLIs in general -- positional args must always come before named args. However, I noticed the docs are incorrect: https://nextflow.io/docs/latest/cli.html#run

$ nextflow run [options] [project]

@mribeirodantas can you correct the docs here? I would also check the entire CLI docs page to see if this error was made for other commands. And the CLI output in Nextflow.

mribeirodantas commented 1 year ago

Sure! I saw the docs page yesterday and was wondering if this was really true. I will work on that.

nick-youngblut commented 1 year ago

It would help to clarify in the nextflow run docs which parameters are boolean versus which require a >=1 argument:

    -with-charliecloud
       Enable process execution in a Charliecloud container runtime
    -with-conda
       Use the specified Conda environment package or file (must end with
       .yml|.yaml suffix)
    -with-dag
       Create pipeline DAG file
    -with-docker
       Enable process execution in a Docker container
    -N, -with-notification
       Send a notification email on workflow completion to the specified
       recipients
    -with-podman
       Enable process execution in a Podman container
    -with-report
       Create processes execution html report
    -with-singularity
       Enable process execution in a Singularity container
    -with-timeline
       Create processes execution timeline file
    -with-tower
       Monitor workflow execution with Seqera Tower service
    -with-trace
       Create processes execution tracing file
    -with-weblog
       Send workflow status messages via HTTP to target URL
    -without-conda
       Disable the use of Conda environments
    -without-docker
       Disable process execution with Docker
       Default: false
    -without-podman
       Disable process execution in a Podman container
    -w, -work-dir
       Directory where intermediate result files are stored
bentsherman commented 1 year ago

I took another look here and it turns out I gave the wrong diagnosis. The problem is that some options like -with-report expect an argument but Nextflow will insert a default "-" if no argument is given. Unfortunately I don't think we can fix this with the current CLI.

We are working on a new CLI called nf (see #3595). I just tested it and I can do the following:

nf run --with-trace --with-report -- main.nf

The double dash allows you to separate positional arguments from optional arguments. But it doesn't seem to work with the current CLI. So I will tie this issue to the new CLI effort.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.