Skip to content

Commit

Permalink
Final small fixes for advanced workflows section (#270)
Browse files Browse the repository at this point in the history
 * Turn the starting message into a quick note that they need to use the
   right profile as the default instead of installing a new code on the
   localhost computer.
 * Fix the code snippets that use the add@localhost computer by putting
   in add@tutor instead. As this is the one that is set up in the basics
   section.
 * Add a note on restarting the daemon every time they make a change to
   the ArithmeticAddBaseWorkChain.
 * Change the submit command shown after the "Expose inputs and outputs"
   section so it also uses the add namespace.
  • Loading branch information
mbercx committed Jul 9, 2020
1 parent f3e43ee commit 728bea4
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions docs/pages/2020_Intro_Week/sections/workflows_adv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,10 @@ Workflows: Advanced

In this hands-on, we'll be looking at some more advanced concepts related to workflows.

.. note::

If you have not already been through :ref:`2020_virtual_intro:workflow_basic`, you should setup the proper ``Code``:

To set up the ``Code`` the work chain uses to add two numbers together:

.. code-block:: console
$ verdi code setup -L add --on-computer --computer=localhost -P arithmetic.add --remote-abs-path=/bin/bash -n
This command sets up a code with *label* ``add`` on the *computer* ``localhost``, using the *plugin* ``arithmetic.add``.
.. important::

To learn more about setting up a computer see :ref:`2020_virtual_intro:running:computer`.
Just as in the :ref:`2020_virtual_intro:workflow_basic` section, we will be using the computers and codes set up in the first two hands-on sessions.
Make sure you have the profile you :ref:`set up at the start of the tutorial<2020_virtual_intro:setup_profile>` set as the default.

Exit Codes
**********
Expand Down Expand Up @@ -217,7 +208,7 @@ We can now launch it like any other work chain and the ``BaseRestartWorkChain``

.. code-block:: python
submit(ArithmeticAddBaseWorkChain, x=Int(3), y=Int(4), code=load_code('add@localhost'))
submit(ArithmeticAddBaseWorkChain, x=Int(3), y=Int(4), code=load_code('add@tutor'))
Once the work chain finished, we can inspect what has happened with, for example, ``verdi process status``:

Expand Down Expand Up @@ -298,11 +289,19 @@ When submitting or running the work chain using namespaced inputs (``add`` in th
'add': {
'x': Int(3),
'y': Int(4),
'code': load_code('add@localhost')
'code': load_code('add@tutor')
}
}
submit(ArithmeticAddBaseWorkChain, **inputs)
.. important::

Every time you make changes to the ``ArithmeticAddBaseWorkChain``, don't forget to restart the daemon with:

.. code-block:: bash
$ verdi daemon restart --reset
Error handling
==============
So far you have seen how easy it is to get a work chain up and running that will run a subprocess using the ``BaseRestartWorkChain``.
Expand All @@ -313,7 +312,7 @@ Let's launch the work chain with inputs that will cause the calculation to fail,

.. code-block:: python
submit(ArithmeticAddBaseWorkChain, x=Int(3), y=Int(-4), code=load_code('add@localhost'))
submit(ArithmeticAddBaseWorkChain, add={'x': Int(3), 'y': Int(-4), 'code': load_code('add@tutor')})
This time we will see that the work chain takes quite a different path:

Expand Down

0 comments on commit 728bea4

Please sign in to comment.