From 99767511399fe16b3db45973693d147a6ded4cf3 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 28 May 2024 09:43:05 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- cylc/flow/platforms.py | 2 +- cylc/flow/task_job_mgr.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cylc/flow/platforms.py b/cylc/flow/platforms.py index 723a10202e8..706d3459009 100644 --- a/cylc/flow/platforms.py +++ b/cylc/flow/platforms.py @@ -302,7 +302,7 @@ def get_platform_from_group( else: platform_names = group['platforms'] - # Return False if there are no platforms available to be selected. + # If there are no platforms available to be selected: if not platform_names: hosts_consumed = [ host diff --git a/cylc/flow/task_job_mgr.py b/cylc/flow/task_job_mgr.py index b833a4ca6d8..89397e0748a 100644 --- a/cylc/flow/task_job_mgr.py +++ b/cylc/flow/task_job_mgr.py @@ -36,7 +36,7 @@ ) from shutil import rmtree from time import time -from typing import TYPE_CHECKING, Any, Union, Optional +from typing import TYPE_CHECKING, Any, List, Union, Optional from cylc.flow import LOG from cylc.flow.job_runner_mgr import JobPollContext @@ -230,7 +230,7 @@ def prep_submit_task_jobs(self, workflow, itasks, check_syntax=True): """ prepared_tasks = [] bad_tasks = [] - out_of_hosts_tasks: list = [] + out_of_hosts_tasks: List[TaskProxy] = [] for itask in itasks: if not itask.state(TASK_STATUS_PREPARING): # bump the submit_num *before* resetting the state so that the @@ -288,10 +288,8 @@ def submit_task_jobs(self, workflow, itasks, curve_auth, auth_itasks.setdefault(platform_name, []) auth_itasks[platform_name].append(itask) # Submit task jobs for each platform - done_tasks = bad_tasks - - # Out of host tasks can be considered done for now: - [done_tasks.append(itask) for itask in out_of_hosts_tasks] + # Non-prepared tasks can be considered done for now: + done_tasks = [*bad_tasks, *out_of_hosts_tasks] for _, itasks in sorted(auth_itasks.items()): # Find the first platform where >1 host has not been tried and