Only print default parameter values that exist in schema - #1
Only print default parameter values that exist in schema#1d-goryslavets wants to merge 4 commits into
Conversation
|
I've added a check for an extra boolean field {
"pipeline": "Base schema",
"params": {
"Pipeline options": {
"indir": {
"required": true,
"help_text": "Directory with isolates to annotate"
}
}
}
}We get the following help message: Pipeline options
--indir
<required>
Directory with isolates to annotateNote that I kept the {
"pipeline": "Base schema",
"params": {
"Pipeline options": {
"indir": {
"required": true,
"help_text": "Directory with isolates to annotate"
}
},
"Annotation option": {
"user_proteins": {
"help_text": "User-provided expert proteins in FASTA format for CDS annotation"
},
"user_hmms": {
"help_text": "User-provided hidden markov model in HMMER format for CDS annotation"
}
}
}
}The Pipeline options
--indir
<required>
Directory with isolates to annotate
-----------------------------------------------------------------
Annotation option
--user_proteins
User-provided expert proteins in FASTA format for CDS annotation
--user_hmms
User-provided hidden markov model in HMMER format for CDS annotation
----------------------------------------------------------------- |
|
thank you Dima for the suggestion, it makes a lot of sense like this. I agree that when the default is a |
flass
left a comment
There was a problem hiding this comment.
this might be a bit pedantic but I think introducing the suggested function would help not inflate this piece of groovy code that is already quite large and hard to digest
|
Ok so I've tested the latest commit in |
flass
left a comment
There was a problem hiding this comment.
test made on my side failed. I suspect there is an unbound variable somewhere
| // print argument key, help text and type (default/required), if provided | ||
| public static void printHelpMessageBlock(argumentKey, argumentBlock, indent, log) { | ||
| log.info indent + "--" + argumentKey | ||
| if (argumentBlock.default) { |
There was a problem hiding this comment.
maybe this does not work when there is no attribute that's been defined with this name for the block
There was a problem hiding this comment.
Hi @flass! Thanks for testing this on your end. While trying to reproduce this, I noticed that this error pops up even without my changes (that is, using the plain irods_extractor workflow). After some digging I'm confident that the problem lies in the incorrect schema structure in one of the irods_extractor's dependencies.
Specifically, it's the pipeline_chaining schema that causes the error. That schema lacks an outer named block for the parameters, which is expected by the NextflowTool parser.
I've opened a merge request on GitLab fixing this. Please check if out when you have time.
Description
If a workflow parameter is mandatory, the help message should not display a default value for it. Currently, if the
defaultfield is omitted for a parameter in the schema, the help message displays it asnull. For instance, for this schema:{ "pipeline": "Base schema", "params": { "Pipeline options": { "indir": { "help_text": "Directory with isolates to annotate" } } } }The help message is:
Pipeline options --indir default: null Directory with isolates to annotatewhich is somewhat misleading. I suggest not printing
default: nullfor mandatory parameters.Changes
I made printing the
defaultfield in thehelp_messagemethod conditional on the presence of thedefaultkey.