From 22f6ffe9de1cc3b84f0bdcebd0a0b90f5b4dfd94 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Mon, 18 May 2020 13:57:46 +0200 Subject: [PATCH] add a better message if an operator implementation happens to be None --- hysop/core/graph/computational_node_frontend.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hysop/core/graph/computational_node_frontend.py b/hysop/core/graph/computational_node_frontend.py index 77b14e2d7..ab75850b0 100644 --- a/hysop/core/graph/computational_node_frontend.py +++ b/hysop/core/graph/computational_node_frontend.py @@ -1,3 +1,4 @@ +import inspect from hysop.constants import Implementation, Backend, implementation_to_backend from hysop.tools.decorators import debug from hysop.tools.types import check_instance, first_not_None @@ -87,6 +88,12 @@ class ComputationalGraphNodeFrontend(ComputationalGraphNodeGenerator): msg+= 'available implementations are:\n {}' msg=msg.format(implementation, '\n '.join(simplementations)) raise ValueError(msg) + elif (self.implementations()[implementation] is None): + msg = 'Specified implementation \'{}\' is registered as an available implementation for operator \'{}\', ' + msg+= 'but no underlying implementation was found. This may be due to missing dependency or a catched ' + msg+= 'import error in file file://{}.' + msg=msg.format(implementation, self.__class__.__name__, inspect.getfile(self.__class__)[:-1]) + raise ValueError(msg) self.implementation = implementation self.backend = implementation_to_backend(implementation) @@ -96,6 +103,7 @@ class ComputationalGraphNodeFrontend(ComputationalGraphNodeGenerator): self._input_fields_to_dump = [] self._output_fields_to_dump = [] + @debug def _generate(self): try: -- GitLab