@@ -83,7 +83,8 @@ def log_platform_event(
83
83
def get_platform (
84
84
task_conf : Optional [str ] = None ,
85
85
task_name : str = UNKNOWN_TASK ,
86
- bad_hosts : Optional [Set [str ]] = None
86
+ bad_hosts : Optional [Set [str ]] = None ,
87
+ evaluated_host : Optional [str ] = None ,
87
88
) -> Dict [str , Any ]:
88
89
...
89
90
@@ -92,7 +93,8 @@ def get_platform(
92
93
def get_platform (
93
94
task_conf : Union [dict , 'OrderedDictWithDefaults' ],
94
95
task_name : str = UNKNOWN_TASK ,
95
- bad_hosts : Optional [Set [str ]] = None
96
+ bad_hosts : Optional [Set [str ]] = None ,
97
+ evaluated_host : Optional [str ] = None ,
96
98
) -> Optional [Dict [str , Any ]]:
97
99
...
98
100
@@ -108,7 +110,8 @@ def get_platform(
108
110
def get_platform (
109
111
task_conf : Union [str , dict , 'OrderedDictWithDefaults' , None ] = None ,
110
112
task_name : str = UNKNOWN_TASK ,
111
- bad_hosts : Optional [Set [str ]] = None
113
+ bad_hosts : Optional [Set [str ]] = None ,
114
+ evaluated_host : Optional [str ] = None ,
112
115
) -> Optional [Dict [str , Any ]]:
113
116
"""Get a platform.
114
117
@@ -121,6 +124,7 @@ def get_platform(
121
124
task_name: Help produce more helpful error messages.
122
125
bad_hosts: A set of hosts known to be unreachable (had an ssh 255
123
126
error)
127
+ evaluated_host: Host name evaluated from platform subshell.
124
128
125
129
Returns:
126
130
platform: A platform definition dictionary. Uses either
@@ -169,6 +173,7 @@ def get_platform(
169
173
glbl_cfg ().get (['platforms' ]),
170
174
task_job_section ,
171
175
task_remote_section ,
176
+ evaluated_host ,
172
177
),
173
178
bad_hosts = bad_hosts ,
174
179
)
@@ -330,7 +335,8 @@ def get_platform_from_group(
330
335
def platform_name_from_job_info (
331
336
platforms : Union [dict , 'OrderedDictWithDefaults' ],
332
337
job : Dict [str , Any ],
333
- remote : Dict [str , Any ]
338
+ remote : Dict [str , Any ],
339
+ evaluated_host : Optional [str ] = None ,
334
340
) -> str :
335
341
"""
336
342
Find out which job platform to use given a list of possible platforms
@@ -385,6 +391,7 @@ def platform_name_from_job_info(
385
391
job: Workflow config [runtime][TASK][job] section.
386
392
remote: Workflow config [runtime][TASK][remote] section.
387
393
platforms: Dictionary containing platform definitions.
394
+ evaluated_host: Host is the result of evaluating a subshell.
388
395
389
396
Returns:
390
397
platform: string representing a platform from the global config.
@@ -422,7 +429,9 @@ def platform_name_from_job_info(
422
429
423
430
# NOTE: Do NOT use .get() on OrderedDictWithDefaults -
424
431
# https://github.com/cylc/cylc-flow/pull/4975
425
- if 'host' in remote and remote ['host' ]:
432
+ if evaluated_host :
433
+ task_host = evaluated_host
434
+ elif 'host' in remote and remote ['host' ]:
426
435
task_host = remote ['host' ]
427
436
else :
428
437
task_host = 'localhost'
0 commit comments