From 9c982c5c3bca64205ac57fed93fae1a8ad365d3c Mon Sep 17 00:00:00 2001 From: Ben Clifford Date: Wed, 31 Jul 2024 13:47:25 +0200 Subject: [PATCH] Add type annotation and error log to _filter_scale_in_ids (#3549) Especially this log message is intended to help user understanding when Parsl is not scaling in as they expected - before this PR, any blocks marked as not-scaled-in were not reported to the user (perhaps on the assumption that it might work next time round?) --- parsl/executors/status_handling.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parsl/executors/status_handling.py b/parsl/executors/status_handling.py index 772fc9a69a..1e4ea3c0b4 100644 --- a/parsl/executors/status_handling.py +++ b/parsl/executors/status_handling.py @@ -167,10 +167,18 @@ def tasks(self) -> Dict[object, Future]: def provider(self): return self._provider - def _filter_scale_in_ids(self, to_kill, killed): + def _filter_scale_in_ids(self, to_kill: Sequence[Any], killed: Sequence[bool]) -> Sequence[Any]: """ Filter out job id's that were not killed """ assert len(to_kill) == len(killed) + + if False in killed: + killed_job_ids = [jid for jid, k in zip(to_kill, killed) if k] + not_killed_job_ids = [jid for jid, k in zip(to_kill, killed) if not k] + logger.warning("Some jobs were not killed successfully: " + f"killed jobs: {killed_job_ids}, " + f"not-killed jobs: {not_killed_job_ids}") + # Filters first iterable by bool values in second return list(compress(to_kill, killed))