From b9df25bdc0c19d140400e9a1f8577914e6e2f9f0 Mon Sep 17 00:00:00 2001 From: R1j1t <22280243+R1j1t@users.noreply.github.com> Date: Mon, 27 May 2024 00:33:35 -0700 Subject: [PATCH] updated missing resource exception --- .../high_throughput/mpi_prefix_composer.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/parsl/executors/high_throughput/mpi_prefix_composer.py b/parsl/executors/high_throughput/mpi_prefix_composer.py index c18b6cb7c1..07abf8f9d5 100644 --- a/parsl/executors/high_throughput/mpi_prefix_composer.py +++ b/parsl/executors/high_throughput/mpi_prefix_composer.py @@ -1,5 +1,5 @@ import logging -from typing import Dict, List, Tuple, Set, Union +from typing import Dict, List, Tuple, Set logger = logging.getLogger(__name__) @@ -8,10 +8,20 @@ 'mpiexec') +class MissingResourceSpecification(Exception): + """Exception raised when input is not supplied a resource specification""" + + def __init__(self, reason: str): + self.reason = reason + + def __str__(self): + return f"Missing resource specification: {self.reason}" + + class InvalidResourceSpecification(Exception): """Exception raised when Invalid input is supplied via resource specification""" - def __init__(self, invalid_keys: Union[Set[str], str]): + def __init__(self, invalid_keys: Set[str]): self.invalid_keys = invalid_keys def __str__(self): @@ -29,7 +39,7 @@ def validate_resource_spec(resource_spec: Dict[str, str], is_mpi_enabled: bool): # empty resource_spec when mpi_mode is set causes parsl to hang # ref issue #3427 if is_mpi_enabled and len(user_keys) == 0: - raise InvalidResourceSpecification('mpi_mode requires parsl_resource_specification to be configured') + raise MissingResourceSpecification('MPI mode requires optional parsl_resource_specification keyword argument to be configured') legal_keys = set(("ranks_per_node", "num_nodes",