Skip to content

Commit

Permalink
Improve error message for missing task engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Aug 7, 2019
1 parent 70478ee commit 31c23b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sos/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,9 @@ def __init__(self, alias: Optional[str] = '',
@classmethod
def reset(cls) -> None:
for host in cls.host_instances.values():
del host._task_engine
# perhaps the engine failed to start
if hasattr(host, '_task_engine'):
del host._task_engine
cls.host_instances = {}

def _get_local_host(self) -> str:
Expand Down Expand Up @@ -1214,7 +1216,7 @@ def _get_host_agent(self, start_engine: bool) -> None:

if task_engine is None:
raise RuntimeError(
f'Failed to locate task engine type {self._task_engine_type}. Available engine types are {", ".join(available_engines)}'
f'This system currently supports task engine{"s" if len(available_engines) > 1 else ""} {", ".join(available_engines)}, not {self._task_engine_type} as specified in the template. Did you install a relevant module such as sos-{self._task_engine_type}?'
)

self.host_instances[self.alias]._task_engine = task_engine
Expand All @@ -1224,7 +1226,8 @@ def _get_host_agent(self, start_engine: bool) -> None:

self._host_agent = self.host_instances[self.alias]
# for convenience
self._task_engine = self._host_agent._task_engine
if hasattr(self._host_agent, '_task_engine')
self._task_engine = self._host_agent._task_engine

# public interface
#
Expand Down

0 comments on commit 31c23b2

Please sign in to comment.