@@ -924,28 +924,40 @@ async def exec_psij(self, runnable, rerun=False):
924
924
import psij
925
925
import pickle
926
926
import os
927
+
927
928
self .psij = psij
928
- jex = psij .JobExecutor .get_instance ('slurm' )
929
-
929
+ jex = psij .JobExecutor .get_instance ("slurm" )
930
+ absolute_path = os .path .dirname (__file__ )
931
+
930
932
if isinstance (runnable , TaskBase ):
931
933
cache_dir = runnable .cache_dir
932
- file_path = os .path .join (cache_dir , ' my_function.pkl' )
933
- with open (file_path , 'wb' ) as file :
934
+ file_path = os .path .join (cache_dir , " my_function.pkl" )
935
+ with open (file_path , "wb" ) as file :
934
936
pickle .dump (runnable ._run , file )
935
- spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function.py" , file_path ])
937
+ func_path = os .path .join (absolute_path , "run_pickled_function.py" )
938
+ spec = self .make_spec ("python" , [func_path , file_path ])
936
939
else : # it could be tuple that includes pickle files with tasks and inputs
937
940
cache_dir = runnable [- 1 ].cache_dir
938
- file_path_1 = os .path .join (cache_dir , ' my_function.pkl' )
939
- file_path_2 = os .path .join (cache_dir , ' taskmain.pkl' )
940
- file_path_3 = os .path .join (cache_dir , ' ind.pkl' )
941
+ file_path_1 = os .path .join (cache_dir , " my_function.pkl" )
942
+ file_path_2 = os .path .join (cache_dir , " taskmain.pkl" )
943
+ file_path_3 = os .path .join (cache_dir , " ind.pkl" )
941
944
ind , task_main_pkl , task_orig = runnable
942
- with open (file_path_1 , 'wb' ) as file :
945
+ with open (file_path_1 , "wb" ) as file :
943
946
pickle .dump (load_and_run , file )
944
- with open (file_path_2 , 'wb' ) as file :
947
+ with open (file_path_2 , "wb" ) as file :
945
948
pickle .dump (task_main_pkl , file )
946
- with open (file_path_3 , 'wb' ) as file :
949
+ with open (file_path_3 , "wb" ) as file :
947
950
pickle .dump (ind , file )
948
- spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function_2.py" , file_path_1 , file_path_2 , file_path_3 ])
951
+ func_path = os .path .join (absolute_path , "run_pickled_function_2.py" )
952
+ spec = self .make_spec (
953
+ "python" ,
954
+ [
955
+ func_path ,
956
+ file_path_1 ,
957
+ file_path_2 ,
958
+ file_path_3 ,
959
+ ],
960
+ )
949
961
950
962
job = self .make_job (spec , None )
951
963
jex .submit (job )
0 commit comments