File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change
1
+ Fix a bug where setting 'batch system' and not setting host could lead to the wrong platform being selected.
Original file line number Diff line number Diff line change 64
64
from cylc .flow .job_runner_mgr import JOB_FILES_REMOVED_MESSAGE , JobPollContext
65
65
from cylc .flow .pathutil import get_remote_workflow_run_job_dir
66
66
from cylc .flow .platforms import (
67
+ FORBIDDEN_WITH_PLATFORM ,
67
68
get_host_from_platform ,
68
69
get_install_target_from_platform ,
69
70
get_localhost_install_target ,
@@ -1222,14 +1223,21 @@ def _prep_submit_task_job(
1222
1223
1223
1224
host_name , platform_name = None , None
1224
1225
try :
1225
- if rtconfig ['remote' ]['host' ] is not None :
1226
+ # We need to assume that we want a host if any of the items
1227
+ # for the old host/batch system plaform selection system are set.
1228
+ if any (
1229
+ rtconfig [section ][key ] is not None
1230
+ for section , values in FORBIDDEN_WITH_PLATFORM .items ()
1231
+ for key in values
1232
+ ):
1226
1233
host_name = self .task_remote_mgr .eval_host (
1227
1234
rtconfig ['remote' ]['host' ]
1228
1235
)
1229
1236
else :
1230
1237
platform_name = self .task_remote_mgr .eval_platform (
1231
1238
rtconfig ['platform' ]
1232
1239
)
1240
+
1233
1241
except PlatformError as exc :
1234
1242
itask .waiting_on_job_prep = False
1235
1243
itask .summary ['platforms_used' ][itask .submit_num ] = ''
Original file line number Diff line number Diff line change @@ -258,3 +258,38 @@ async def test_poll_job_deleted_log_folder(
258
258
assert log_filter (
259
259
logging .ERROR , f"job log directory { job_id } no longer exists"
260
260
)
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'
You can’t perform that action at this time.
0 commit comments