aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
431 stars 187 forks source link

Docs: `verdi plugin list <plugin>` returns incomplete information for each `help` parameter. #5019

Open demiranda-gabriel opened 3 years ago

demiranda-gabriel commented 3 years ago

Just a minor issue that was suggested to be opened at the AiiDA Tutorial:

Describe the current issue

Getting information about a specific calculation/workflow plugin with verdi plugin list (e.g. verdi plugin list aiida.calculations arithmetic.add) returns incomplete information from the help parameter for each spec defined in the plugin (if its string is too long). For instance, in this case, it returns:

Description:

CalcJob implementation to add two numbers using bash for testing and demonstration purposes.

Inputs: code: required Code The Code to use for this job. x: required Int, Float The left operand. y: required Int, Float The right operand. metadata: optional Outputs: remote_folder: required RemoteData Input files necessary to run the process will be stored in this folder node ... retrieved: required FolderData Files that are retrieved by the daemon will be stored in this node. By defa ... sum: required Int, Float The sum of the left and right operand. remote_stash: optional RemoteStashData Contents of the stash.source_list option are stored in this remote folder ... Exit codes: 1: The process has failed with an unspecified error. 2: The process failed with legacy failure mode. 11: The process did not register a required output. 100: The process did not have the required retrieved output. 110: The job ran out of memory. 120: The job ran out of walltime. 310: The output file could not be read. 320: The output file contains invalid output. 410: The sum of the operands is a negative number.

Describe the solution you'd like

It could be helpful if the complete string stored in the help parameter of each spec could be displayed with this verdi command.

mbercx commented 3 years ago

Hello again @demiranda-gabriel, and congrats on raising your first issue! ๐ŸŽ‰ ๐Ÿ˜„

That's a good point! It seems the exit codes help are returned fully over multiple lines, but that of the inputs and outputs is not. This really is too bad in case of e.g. the parallelization options for the PwCalculation:

$ verdi plugin list aiida.calculations quantumespresso.pw
Description:

    `CalcJob` implementation for the pw.x code of Quantum ESPRESSO.

Inputs:
                       code:  required  Code              The `Code` to use for this job.
                    kpoints:  required  KpointsData       kpoint mesh or kpoint path
                 parameters:  required  Dict              The input parameters that are to be used to construct the input file.
                    pseudos:  required  UpfData, UpfData  A mapping of `UpfData` nodes onto the kind name to which they should apply.
                  structure:  required  StructureData     The input structure.
               hubbard_file:  optional  SinglefileData    SinglefileData node containing the output Hubbard parameters from a HpCalcu ...
                   metadata:  optional                    
            parallelization:  optional  Dict              Parallelization options. The following flags are allowed:
npool  : The numb ...

There should at least be an option to show the full help, the whole point of adding this is to make the calculation jobs and work chains self-documenting.

Let me know if you want to have a crack at fixing this! I'd be happy to meet in gather.town to show you what part of the code needs to be adjusted, and discuss the best way to do it. (if I can figure it out ๐Ÿ˜… )

mbercx commented 3 years ago

As a side note, since GitHub uses Markdown, you can use triple backticks ``` to have nice code blocks, for example:

I am a code block!

You can also add syntax highlighting by adding the language to the first triple backticks. For example, this:

```python
def iam():
    print('I am a code-block!')

Will show:

```python
def iam():
    print('I am a code-block!')

You might be wondering how I show the code blocks with the actual back ticks. ^^ This is done by adding an extra backtick fence (I think this is the correct term), but then with four backticks:

I am a code block!

To show the code snippet above then, I had to make a backtick fence with five backticks. ๐Ÿ˜„

EDIT: Here you can find a little tutorial on using Markdown on GitHub:

https://guides.github.com/features/mastering-markdown/

It's really cool! ๐Ÿ’ฏ

demiranda-gabriel commented 3 years ago

Hi there Marnik! Thank you for you tips and help on Markdown :smile:. I really hope to start learning and using more of these GitHub collab features, it's really cool!

As it may not be a too urgent feature to have, I'd indeed appreciate giving it a try :smiley:. I can send you an email so we could try to arrange some time to talk about it, then. Thanks!

sphuber commented 3 years ago

Just a quick note that another current shortcoming of this help functionality (I don't think there is already an issue for this) is that the nested namespaces are not shown. So you only see the top level namespace, but not what is nested within it which is ultimately what is important, especially for inputs. The challenge here is that it might not be trivial to always format this information in such a way that it is still readable on the CLI. This is certainly the reason why I didn't add this from the beginning. In other output formats, like html, you can use dynamic features like using collapsible components that expand when needed.