def stop_service(self, request): """Stops a running Clara service Args: request (RequestParser): Request received from Orchestrator to stop a Service """ container_name = request.next_string() engine_name = request.next_string() service_name = ClaraUtils.form_service_name(container_name, engine_name) if container_name in self.my_containers: try: self.my_containers[container_name].remove_service(service_name) except Exception as e: raise Exception("Could not stop service %s: %s " % (service_name, e)) else: raise Exception("Could not stop service %s: missing container " % service_name)
def test_form_service_name(self): test_case = ClaraUtils.form_service_name("192.168.0.1_java:some_container", "some_engine") self.assertTrue(ClaraUtils.is_service_name(test_case)) self.assertEqual(test_case, "192.168.0.1_java:some_container:some_engine")