Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial: Use Cylc Reinstall & Reload #561

Open
wants to merge 2 commits into
base: 8.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tutorial/runtime/configuration-consolidation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ Which Approach To Use

.. ifslides::

Next section: :ref:`Rose Tutorial <tutorial-rose-configurations>`
Next section: :ref:`Reinstalling workflows <tutorial.Reinstalling-workflows>`
1 change: 1 addition & 0 deletions src/tutorial/runtime/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ This section covers:
introduction
runtime-configuration
configuration-consolidation/index
reinstalling
155 changes: 155 additions & 0 deletions src/tutorial/runtime/reinstalling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
.. _tutorial.Reinstalling-workflows:

Fixing and Reloading Workflows
==============================

.. admonition:: Aim

Use ``cylc reinstall`` and ``cylc reload`` to repair a broken workflow
configuration without having to run the whole workflow again.
hjoliver marked this conversation as resolved.
Show resolved Hide resolved


.. ifnotslides::

Consider a workflow where a a large part of the runtime has completed,
but a late task has failed.

.. digraph:: workflow

rankdir="LR"
get_data -> process_data
get_data[
label="get data\n(very slow)",
color="forestgreen",
fillcolor=palegreen,
style=filled
]
process_data[
label="process data",
color="red",
fillcolor=palevioletred,
style=filled
]

.. ifnotslides::

Having identified the problem with the late task we want to
update the runtime definition of the installed workflow rather than
re-run the whole thing.


.. practical::

.. rubric:: In this practical we will break the
:ref:`weather-forecasting workflow <tutorial-datetime-cycling-practical>`
from the :ref:`scheduling tutorial <tutorial-scheduling>`.

#. **Get your own copy of the workflow**

Use ``cylc get-resources`` to get a new copy of the workflow.


.. code-block:: bash

cylc get-resources tutorial/cylc-forecasting-workflow
cd ~/cylc-src/cylc-forecasting-workflow


#. **Break the ``post_process`` task**

Change the task script for the ``post_process`` task in
``flow.cylc`` to make it fail:

.. code-block:: diff

- script = post-process $CYLC_TASK_PARAM_site 60
+ script = exit 1

#. **Install, Play and inspect the workflow**

And check that ``post_process`` fails.

.. spoiler:: Step-by-step

.. code-block:: bash

cylc validate # always good practice
cylc install
cylc play cylc-forecasting-workflow
# Either view in TUI or GUI, or run:
cylc cat-log cylc-forecasting-workflow
MetRonnie marked this conversation as resolved.
Show resolved Hide resolved
# Inspect job log for failed task:
cylc cat-log cylc-forecasting-workflow//<cycle point>/post_process


.. nextslide::

.. ifnotslides::

You can copy any changes in the :term:`source directory` to the
:term:`run directory` using:

.. code-block::

cylc reinstall <workflow_id>

.. ifnotslides::

But this does not reload the running workflow. To do that you need to use:

.. code-block:: bash

cylc reload <workflow_id>


.. ifnotslides::

.. note::

You may prefer to use ``cylc pause`` before reloading the workflow to
make if clearer which tasks were run before and after your changes.
After reinstalling and reloading the workflow use ``cylc play`` to
resume the workflow.


.. practical::

.. rubric:: In this practical we will fix the workflow we broke in the
first practical, then re-run the broken task.

#. **Fix the ``post_process`` task**

Change the task script for the ``post_process`` task in
``flow.cylc`` to make it pass again:

.. code-block:: diff

- script = exit 1
+ script = post-process $CYLC_TASK_PARAM_site 60

#. **Use Cylc Reinstall and Reload to fix the workflow**

.. code-block:: bash

cylc reinstall cylc-forecasting-workflow
# You can do this in the cylc tui or GUI
cylc reload cylc-forecasting-workflow
cylc trigger cylc-forecasting-workflow//<cycle point>/post_process

#. **Check that the workflow has finished**

Have a look at the workflow log:

.. code-block::

cylc cat-log cylc-forecasting-workflow

You should see that ``post_process`` has succeeded:

.. code-block::

INFO - [20221027T1300Z/post_process_exeter running job:02 flows:1] => succeeded

.. ifslides::

Next section: :ref:`Rose Tutorial <tutorial-rose-configurations>`
Loading