Skip to content

Commit

Permalink
docs: minor fixes for code plugin howto (#5014)
Browse files Browse the repository at this point in the history
In particular, start following the exit code conventions.
  • Loading branch information
ltalirz authored Jul 8, 2021
1 parent 7e67e1a commit 58df44c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aiida/calculations/diff_tutorial/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def define(cls, spec):
}
spec.inputs['metadata']['options']['parser_name'].default = 'diff-tutorial'

spec.exit_code(100, 'ERROR_MISSING_OUTPUT_FILES',
spec.exit_code(300, 'ERROR_MISSING_OUTPUT_FILES',
message='Calculation did not produce all expected output files.')


Expand Down
11 changes: 7 additions & 4 deletions docs/source/howto/plugin_codes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ The ``DiffCalculation`` example, defines the following exit code:

.. code-block:: python
spec.exit_code(100, 'ERROR_MISSING_OUTPUT_FILES', message='Calculation did not produce all expected output files.')
spec.exit_code(300, 'ERROR_MISSING_OUTPUT_FILES', message='Calculation did not produce all expected output files.')
An ``exit_code`` defines:

* an exit status (a positive integer),
* an exit status (a positive integer, following the :ref:`topics:processes:usage:exit_code_conventions`),
* a label that can be used to reference the code in the |parse| method (through the ``self.exit_codes`` property, as shown below), and
* a message that provides a more detailed description of the problem.

Expand Down Expand Up @@ -333,7 +333,7 @@ With your ``calculations.py`` and ``parsers.py`` files at hand, let's register e
.. code-block:: console
$ pip install -e . # install package in "editable mode"
reentry scan
$ reentry scan
See the :ref:`how-to:plugins-install` section for details.

Expand Down Expand Up @@ -440,7 +440,10 @@ You can use the verdi command line interface to :ref:`monitor<topics:processes:u

.. code-block:: bash
$ verdi process list
$ verdi process list -a -p1
This should show the processes of both calculations you just ran.
Use ``verdi calcjob outputcat <pk>`` to check the output of the calculation you submitted to the daemon.

Congratulations - you can now write plugins for external simulation codes and use them to submit calculations!

Expand Down

0 comments on commit 58df44c

Please sign in to comment.