Skip to content

Commit 68c5749

Browse files
authored
Merge pull request #7054 from oliver-sanders/7016
pause: fix trigger whilst paused logic
2 parents 1a3014b + f7dfd08 commit 68c5749

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

changes.d/7054.fix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix an issue where job submission could fail with the message
2+
`No such file or directory` when tasks were triggered while the workflow was
3+
paused.

cylc/flow/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def release_tasks_to_run(self) -> bool:
13541354
# finish processing preparing tasks
13551355
pre_prep_tasks.update({
13561356
itask for itask in self.pool.get_tasks()
1357-
if itask.state(TASK_STATUS_PREPARING)
1357+
if itask.waiting_on_job_prep
13581358
})
13591359
else:
13601360
# release queued tasks

tests/integration/test_force_trigger.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from cylc.flow.cycling.integer import IntegerPoint
4040
from cylc.flow.scheduler import Scheduler
4141
from cylc.flow.task_state import (
42-
TASK_STATUS_PREPARING,
4342
TASK_STATUS_FAILED,
4443
TASK_STATUS_RUNNING,
4544
TASK_STATUS_SUBMITTED,
@@ -696,7 +695,7 @@ async def test_trigger_with_sequential_task(flow, scheduler, run, log_filter):
696695
await asyncio.sleep(0)
697696

698697

699-
async def test_trigger_whilst_paused_preparing(flow, scheduler, run, complete):
698+
async def test_trigger_whilst_paused_preparing(one, run, complete):
700699
"""It should run "preparing" tasks even if the workflow is paused.
701700
702701
Remote init leaves tasks as preparing for a while. These must still be
@@ -705,22 +704,15 @@ async def test_trigger_whilst_paused_preparing(flow, scheduler, run, complete):
705704
See https://github.com/cylc/cylc-flow/pull/6768
706705
707706
"""
708-
id_ = flow(
709-
{
710-
'scheduling': {
711-
'graph': {'R1': 'a'},
712-
},
713-
}
714-
)
715-
schd = scheduler(id_)
716-
async with run(schd):
717-
718-
# Instead of triggering, artificially set it as preparing.
719-
a = schd.pool.get_tasks()[0]
720-
a.state_reset(TASK_STATUS_PREPARING)
707+
async with run(one):
708+
await run_cmd(
709+
force_trigger_tasks(
710+
one, [one.pool.get_tasks()[0].tokens.relative_id], ['1']
711+
)
712+
)
721713

722714
# 1/a should run even though the workflow is paused.
723-
await complete(schd, '1/a', allow_paused=True, timeout=1)
715+
await complete(one, '1/one', allow_paused=True, timeout=1)
724716

725717

726718
async def test_trigger_with_task_selector(flow, scheduler, start, monkeypatch):

0 commit comments

Comments
 (0)