diff --git a/src/prerna/engine/impl/guardrail/AbstractPythonGuardrailReactorFunctionEngine.java b/src/prerna/engine/impl/guardrail/AbstractPythonGuardrailReactorFunctionEngine.java index 066bf9dea2..51bcf70f0e 100644 --- a/src/prerna/engine/impl/guardrail/AbstractPythonGuardrailReactorFunctionEngine.java +++ b/src/prerna/engine/impl/guardrail/AbstractPythonGuardrailReactorFunctionEngine.java @@ -28,6 +28,7 @@ package prerna.engine.impl.guardrail; import java.io.File; +import java.io.IOException; import java.util.Properties; import java.util.concurrent.locks.ReentrantLock; @@ -176,4 +177,23 @@ protected void startServer(int port) { } } + /** + * Stops the python process this guardrail started, so an instance opened again + * starts its own and runs the current python files. The process's folder is + * kept: it is the engine's {@code py} folder, which the startup script puts on + * the python path for the guardrail's own modules. + */ + @Override + public void close() throws IOException { + super.close(); + this.startServerLock.lock(); + try { + if (this.cpw != null) { + this.cpw.shutdown(false); + } + } finally { + this.startServerLock.unlock(); + } + } + }