|
| 1 | +# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 2 | +# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 3 | +# |
| 4 | +# This program is free software: you can redistribute it and/or modify |
| 5 | +# it under the terms of the GNU General Public License as published by |
| 6 | +# the Free Software Foundation, either version 3 of the License, or |
| 7 | +# (at your option) any later version. |
| 8 | +# |
| 9 | +# This program is distributed in the hope that it will be useful, |
| 10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +# GNU General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU General Public License |
| 15 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | + |
| 18 | +async def test_almost_self_suicide(flow, scheduler, start): |
| 19 | + """Suicide triggers should not count as upstream tasks when looking |
| 20 | + to spawn parentless tasks. |
| 21 | +
|
| 22 | + https://github.com/cylc/cylc-flow/issues/6594 |
| 23 | +
|
| 24 | + For the example under test, pre-requisites for ``!a`` should not be |
| 25 | + considered the same as pre-requisites for ``a``. If the are then then |
| 26 | + is parentless return false for all cases of ``a`` not in the inital cycle |
| 27 | + and subsequent cycles never run. |
| 28 | + """ |
| 29 | + wid = flow({ |
| 30 | + 'scheduler': {'cycle point format': '%Y'}, |
| 31 | + 'scheduling': { |
| 32 | + 'initial cycle point': 1990, |
| 33 | + 'final cycle point': 1992, |
| 34 | + 'graph': { |
| 35 | + 'R1': 'install_cold', |
| 36 | + 'P1Y': 'install_cold[^] => a? => b?\nb:fail? => !a?' |
| 37 | + } |
| 38 | + } |
| 39 | + }) |
| 40 | + schd = scheduler(wid) |
| 41 | + async with start(schd): |
| 42 | + tasks = [str(t) for t in schd.pool.get_tasks()] |
| 43 | + for task in ['1990/a:waiting', '1991/a:waiting', '1992/a:waiting']: |
| 44 | + assert task in tasks |
0 commit comments