@@ -59,17 +59,6 @@ protected ApposeProcess() throws IOException
5959 if ( logger .isInfoEnabled () )
6060 logger .info ( "Set up environment. Path: {}. Time elapsed: {}" , environment .base (), stopWatch .formatSplitTime () );
6161 this .pythonWorker = environment .python ();
62- Service .Task doImports = this .pythonWorker .task ( generateImportStatements (), "main" );
63- doImports .listen ( getTaskListener ( stopWatch , doImports ) );
64- try
65- {
66- doImports .waitFor ();
67- }
68- catch ( InterruptedException e )
69- {
70- logger .error ( "Import task interrupted: {}" , e .getMessage (), e );
71- Thread .currentThread ().interrupt ();
72- }
7362 // this.pythonWorker.debug( logger::info );
7463 this .inputs = new HashMap <>();
7564 }
@@ -198,6 +187,18 @@ protected static boolean isPythonTaskInterrupted( final Service.Task task )
198187
199188 protected Service .Task runScript () throws IOException
200189 {
190+ Service .Task doImports = pythonWorker .task ( generateImportStatements (), "main" );
191+ doImports .listen ( getTaskListener ( stopWatch , doImports ) );
192+ try
193+ {
194+ doImports .waitFor ();
195+ }
196+ catch ( InterruptedException e )
197+ {
198+ logger .error ( "Import task interrupted: {}" , e .getMessage (), e );
199+ Thread .currentThread ().interrupt ();
200+ }
201+
201202 String script = generateScript ();
202203 Service .Task task = pythonWorker .task ( script , inputs , null );
203204 stopWatch .split ();
0 commit comments