def _on_mpi(self, data): parsed_data = meta_protocol.read_init(data) try: if self._params: init_params = self._params.copy() parsed_data.update(init_params) self._adapter.initialize(parsed_data, self._config_file) except Exception as err: res = meta_protocol.write_init(err) else: res = meta_protocol.write_init() return res
def _on_mpi(self, data): parsed_data = meta_protocol.read_init(data) try: if self._params: init_params = self._params.copy() parsed_data.update(init_params) self._adapter.initialize(parsed_data, self._config_file) except Exception as err: res = meta_protocol.write_init(err) else: res = meta_protocol.write_init() return res
def test_mpi_generic_exception(self): """Tests the response to an MPI request in the case of a generic exception. """ res = metadata_protocol.write_init( exception=RuntimeError("Generic Error")) self.assertEqual("MPI|E|Generic+Error", res)
def test_mpi_metaproviderexception(self): """Tests the response to an MPI request in the case of a MetadataProviderError. """ error = MetadataProviderError("MetaProvider Error") res = metadata_protocol.write_init(exception=error) self.assertEqual("MPI|EM|MetaProvider+Error", res)
def test_mpi_metaproviderexception(self): """Tests the response to a MPI request in case of a MetadataProviderError. """ error = MetadataProviderError("MetaProvider Error") res = metadata_protocol.write_init(error) self.assertEqual("MPI|EM|MetaProvider+Error", res)
def test_mpi_with_parameters(self): """Tests the response to an MPI request with a list of parameters.""" parameters = {'param1': 'value1', 'param2': 'value2'} res = metadata_protocol.write_init(parameters) self.assertEqual("MPI|S|param1|S|value1|S|param2|S|value2", res)
def test_mpi(self): """Tests the response to an MPI request.""" res = metadata_protocol.write_init() self.assertEqual("MPI|V", res)
def test_mpi_generic_exception(self): """Tests the response to a MPI request in case of a generic exception. """ res = metadata_protocol.write_init(RuntimeError("Generic Error")) self.assertEqual("MPI|E|Generic+Error", res)
def test_mpi(self): """Tests the response to a MPI request.""" res = metadata_protocol.write_init() self.assertEqual("MPI|V", res)