question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional parameters with defaults can not be overridden by inputs.json

See original GitHub issue

Say I have a task called bwaMem in a workflow called alignment.

The task bwaMem looks as follows.

task bwaMem {
  File in1
  File? in2
  String indexBase
  Int? threads = 1
  command {
   bwa mem ${"-t" +threads}  ${indexBase} ${in1} ${in2}
  }
  output {
    File samFile = glob(*.sam)
  }
 runtime {
  cpu = select_first([threads])  
  }
}

Then I can use the following inputs.json for the workflow alignment:

{
  "alignment.bwaMem.threads": 3
}

But this is ignored. The default value of 1 is used. On the contrary, if I set defaults for the alignment workflow itself. I can override these in the inputs.json. But apparently this does not work for imported tasks?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cjllanwarnecommented, May 3, 2018

I agree that optional task inputs not being overridable from the inputs json is a bug and should be fixed.

Regarding defaults vs fixing values, you’re both right - values like that might be intended as inputs or might be intended as fixed intermediate values depending on the context and it’s really hard to deduce which one an author intended just based on the WDL file.

That kind of confusion is exactly why WDL 1.0 (you’re currently writing in draft-2) is adding input sections. Ie:

workflow foo {
  input {
    # input with default
    Int threads = 1
  }
}

vs

workflow foo {
  input {
    ...
  }
  
  # intermediate value: cannot be overridden
  Int threads = 1
}
0reactions
rhpvordermancommented, Jul 24, 2018

Closed as not an issue anymore in 1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameters are not overridden in Input Steps when running a ...
Issue. The parameters in a flow file could not be applied to the Input steps when using the command line to override ​the...
Read more >
Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >
creating a function that deals with optional parameters
The purpose of the options specified are to give you default values. If you specify one of these, then the value you provide...
Read more >
Understanding Default Parameters in JavaScript - DigitalOcean
In this case, the default parameter values were calculated, and an explicit undefined value did not override them.
Read more >
Allow Task Group parameters to be optional
while explicitly marking the task group input parameter as optional is not supported, setting a default value and subsequently overriding the value is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found