Skip to content

Commit

Permalink
updated missing resource exception
Browse files Browse the repository at this point in the history
  • Loading branch information
R1j1t committed May 27, 2024
1 parent 68b612e commit b9df25b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions parsl/executors/high_throughput/mpi_prefix_composer.py
Original file line number Diff line number Diff line change
@@ -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__)

Expand All @@ -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):
Expand All @@ -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",
Expand Down

0 comments on commit b9df25b

Please sign in to comment.