public PythonExecutionResult exec ( String script , Map < String , Serializable > callArguments ) { checkValidInterpreter ( ) ; initInterpreter ( ) ; prepareInterpreterContext ( callArguments ) ; Exception originException = null ; for ( int i = 0 ; i < RETRIES_NUMBER_ON_THREADED_ISSUE ; i ++ ) { try { return exec ( script ) ; } catch ( Exception e ) { if ( ! isThreadsRelatedModuleIssue ( e ) ) { throw new RuntimeException ( "Error executing python script: " + e , e ) ; } if ( originException == null ) { originException = e ; } } } throw new RuntimeException ( "Error executing python script: " + originException , originException ) ; }
we need this method to be synchronized so we will not have multiple scripts run in parallel on the same context