|
| 1 | +.. _workflow-run-modes: |
| 2 | + |
| 3 | +Workflow Run Modes |
| 4 | +================== |
| 5 | + |
| 6 | +Cylc can run a workflow without running the real jobs, which may be |
| 7 | +useful when developing workflows. Tasks |
| 8 | +in :ref:`workflow-run-modes.dummy` and |
| 9 | +:ref:`workflow-run-modes.simulation` can help you to understand how different outcomes |
| 10 | +and run lengths will affect the workflow. |
| 11 | + |
| 12 | +To start a workflow in one of these modes: |
| 13 | + |
| 14 | +.. code-block:: console |
| 15 | +
|
| 16 | + $ cylc play --mode=dummy <workflow-id> |
| 17 | + $ cylc play --mode=simulation <workflow-id> |
| 18 | +
|
| 19 | +.. admonition:: Limitations |
| 20 | + |
| 21 | + * A workflow cannot be :term:`restarted <restart>` in a different run mode. Instead, |
| 22 | + install a new instance of the workflow and run it from scratch in the new mode. |
| 23 | + * Workflows run in Dummy and Simulation mode do not allow the run mode of |
| 24 | + individual tasks to be overridden by :ref:`task-run-modes.skip` |
| 25 | + |
| 26 | + |
| 27 | +.. _workflow-run-modes.dummy: |
| 28 | + |
| 29 | +Dummy Mode |
| 30 | +---------- |
| 31 | + |
| 32 | +**Dummy mode** replaces real jobs with background jobs on the |
| 33 | +scheduler host which use ``sleep`` to simulate the run length according to |
| 34 | +the settings described for simulation mode. |
| 35 | +This avoids :term:`job runner` directives that request compute |
| 36 | +resources for real workflow tasks, and it allows any workflow configuration to |
| 37 | +be run locally in dummy mode. |
| 38 | + |
| 39 | +.. admonition:: Limitations |
| 40 | + |
| 41 | + * Dummy mode can only be applied to a whole workflow. |
| 42 | + * Dummy tasks run locally, so dummy mode does not test communication with remote |
| 43 | + job platforms. However, it is easy to write a live-mode test workflow with |
| 44 | + simple ``sleep 10`` tasks that submit to a remote platform. |
| 45 | + |
| 46 | + |
| 47 | +.. _workflow-run-modes.simulation: |
| 48 | + |
| 49 | +Simulation Mode |
| 50 | +--------------- |
| 51 | + |
| 52 | +**Simulation mode** does not run real jobs, and does not generate job |
| 53 | +log files. Instead, the scheduler internally simulates task completion to evolve |
| 54 | +the workflow. |
| 55 | + |
| 56 | + |
| 57 | +Simulated Run Length |
| 58 | +^^^^^^^^^^^^^^^^^^^^ |
| 59 | + |
| 60 | +The default dummy or simulated job run length is 10 seconds. It can be |
| 61 | +changed with :cylc:conf:`[runtime][<namespace>][simulation]default run length`. |
| 62 | + |
| 63 | +If :cylc:conf:`[runtime][<namespace>]execution time limit` and |
| 64 | +:cylc:conf:`[runtime][<namespace>][simulation]speedup factor` are both set, |
| 65 | +run length is computed by dividing the |
| 66 | +execution time limit by the speedup factor. |
| 67 | + |
| 68 | +Simulated Failure |
| 69 | +^^^^^^^^^^^^^^^^^ |
| 70 | + |
| 71 | +Tasks always complete all custom outputs, and by default they will succeed. |
| 72 | + |
| 73 | +If you want to test emitting only some custom outputs |
| 74 | +you can run the workflow in live mode with task run modes |
| 75 | +set to :ref:`skip mode <task-run-modes.skip>`. |
| 76 | + |
| 77 | +You can set some or all instances of a task to fail using |
| 78 | +:cylc:conf:`[runtime][<namespace>][simulation]fail cycle points`, |
| 79 | +which takes either a list of cycle point strings or "all". |
| 80 | + |
| 81 | +Tasks set to fail will succeed on their second or following simulated |
| 82 | +submission. If you want all submissions to fail, set |
| 83 | +:cylc:conf:`[runtime][<namespace>][simulation]fail try 1 only = False`. |
| 84 | + |
| 85 | +For example, to simulate a task you know to be flaky on the half |
| 86 | +hour but not on the hour: |
| 87 | + |
| 88 | +.. code-block:: cylc |
| 89 | +
|
| 90 | + [[get_observations]] |
| 91 | + execution retry delays = PT30S |
| 92 | + [[[simulation]]] |
| 93 | + fail cycle points = 2022-01-01T00:30Z, 2022-01-01T01:30Z |
| 94 | +
|
| 95 | +In another case you might not expect the retry to work, and want to test |
| 96 | +whether your failure handling works correctly: |
| 97 | + |
| 98 | +.. code-block:: cylc |
| 99 | +
|
| 100 | + [[get_data]] |
| 101 | + execution retry delays = PT30S |
| 102 | + [[[simulation]]] |
| 103 | + fail try 1 only = false |
| 104 | + fail cycle points = 2022-01-01T03:00Z |
| 105 | +
|
| 106 | +.. admonition:: Limitations |
| 107 | + |
| 108 | + * Simulation mode can only be applied to a whole workflow. |
| 109 | + * Alternate path branching is difficult to simulate effectively. You can |
| 110 | + configure certain tasks to fail via |
| 111 | + :cylc:conf:`[runtime][<namespace>][simulation]`, but all branches based |
| 112 | + on mutually exclusive custom outputs will run because all custom outputs get |
| 113 | + artificially completed in dummy mode and in simulation mode. |
0 commit comments