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 69
69
)
70
70
from cylc .flow .pathutil import get_remote_workflow_run_job_dir
71
71
from cylc .flow .platforms import (
72
+ FORBIDDEN_WITH_PLATFORM ,
72
73
get_host_from_platform ,
73
74
get_install_target_from_platform ,
74
75
get_localhost_install_target ,
@@ -1177,14 +1178,21 @@ def _prep_submit_task_job(
1177
1178
1178
1179
host_name , platform_name = None , None
1179
1180
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
+ ):
1181
1188
host_name = self .task_remote_mgr .eval_host (
1182
1189
rtconfig ['remote' ]['host' ]
1183
1190
)
1184
1191
else :
1185
1192
platform_name = self .task_remote_mgr .eval_platform (
1186
1193
rtconfig ['platform' ]
1187
1194
)
1195
+
1188
1196
except PlatformError as exc :
1189
1197
itask .waiting_on_job_prep = False
1190
1198
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