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

optional parameter for secret directive #5243

Open
nick-youngblut opened this issue Aug 20, 2024 · 0 comments
Open

optional parameter for secret directive #5243

nick-youngblut opened this issue Aug 20, 2024 · 0 comments

Comments

@nick-youngblut
Copy link
Contributor

New feature

I want to run an optional process only if the user has provided a secret. Example code:

workflow SUMMARY_WF { 
    main:
    OPTIONAL_PROCESS()
}

process OPTIONAL_PROCESS {
    secret "API_KEY"
  
    output:
    path "output/"

    script:
    """
    run_job.py
    """
}

Currently, if the user has not set the secret for OPTIONAL_PROCESS, the pipeline dies with the following error:

ERROR ~ Error executing process > 'SUMMARY_WF:OPTIONAL_PROCESS (1)'

Caused by:
  Required secret is missing: 'API_KEY'

As far as I can tell from the Nextflow docs, the secret: directive does not include an optional parameter.

Usage scenario

To allow secrets to be optional instead of required. If the secret is not set for the target process, then the environmental variable is empty, and the pipeline developer can thus include a check for the env variable in their code (e.g., if os.getenv("API_KEY") is None:).

Suggest implementation

Add an optional parameter to the secrets: directive.

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

No branches or pull requests

1 participant