Skip to content

Commit 67a0864

Browse files
Merge pull request #6995 from cylc/8.5.x-sync
🤖 Merge 8.5.x-sync into master
2 parents 34bb1f7 + 3c253fa commit 67a0864

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

changes.d/6990.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug where setting 'batch system' and not setting host could lead to the wrong platform being selected.

cylc/flow/task_job_mgr.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
)
7070
from cylc.flow.pathutil import get_remote_workflow_run_job_dir
7171
from cylc.flow.platforms import (
72+
FORBIDDEN_WITH_PLATFORM,
7273
get_host_from_platform,
7374
get_install_target_from_platform,
7475
get_localhost_install_target,
@@ -1177,14 +1178,21 @@ def _prep_submit_task_job(
11771178

11781179
host_name, platform_name = None, None
11791180
try:
1180-
if rtconfig['remote']['host'] is not None:
1181+
# We need to assume that we want a host if any of the items
1182+
# for the old host/batch system plaform selection system are set.
1183+
if any(
1184+
rtconfig[section][key] is not None
1185+
for section, values in FORBIDDEN_WITH_PLATFORM.items()
1186+
for key in values
1187+
):
11811188
host_name = self.task_remote_mgr.eval_host(
11821189
rtconfig['remote']['host']
11831190
)
11841191
else:
11851192
platform_name = self.task_remote_mgr.eval_platform(
11861193
rtconfig['platform']
11871194
)
1195+
11881196
except PlatformError as exc:
11891197
itask.waiting_on_job_prep = False
11901198
itask.summary['platforms_used'][itask.submit_num] = ''

tests/integration/test_task_job_mgr.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,38 @@ async def test_poll_job_deleted_log_folder(
258258
assert log_filter(
259259
logging.ERROR, f"job log directory {job_id} no longer exists"
260260
)
261+
262+
263+
async def test__prep_submit_task_job_impl_handles_all_old_platform_settings(
264+
flow: Fixture,
265+
scheduler: Fixture,
266+
start: Fixture,
267+
mock_glbl_cfg: Fixture,
268+
):
269+
"""Ensure that if the old host/batch system settings
270+
are set that task job manager will wait for the any hostname to be
271+
resolved.
272+
273+
https://github.com/cylc/cylc-flow/pull/6990
274+
"""
275+
mock_glbl_cfg(
276+
'cylc.flow.platforms.glbl_cfg',
277+
'''
278+
[platforms]
279+
[[bakery]]
280+
hosts = localhost
281+
job runner = loaf
282+
''',
283+
)
284+
id_ = flow({
285+
"scheduling": {"graph": {"R1": "a"}},
286+
"runtime": {"a": {"job": {"batch system": "loaf"}}}
287+
})
288+
289+
schd = scheduler(id_, run_mode='live')
290+
async with start(schd):
291+
task_a = schd.pool.get_tasks()[0]
292+
with suppress(FileExistsError):
293+
schd.task_job_mgr._prep_submit_task_job(task_a)
294+
295+
assert task_a.platform['name'] == 'bakery'

0 commit comments

Comments
 (0)