@@ -923,22 +923,29 @@ def make_job(self, spec, attributes):
923
923
async def exec_psij (self , runnable , rerun = False ):
924
924
import psij
925
925
import pickle
926
+ import os
926
927
self .psij = psij
927
928
jex = psij .JobExecutor .get_instance ('slurm' )
928
-
929
+
929
930
if isinstance (runnable , TaskBase ):
930
- with open ('/pydra/pydra/engine/my_function.pkl' , 'wb' ) as file :
931
+ cache_dir = runnable .cache_dir
932
+ file_path = os .path .join (cache_dir , 'my_function.pkl' )
933
+ with open (file_path , 'wb' ) as file :
931
934
pickle .dump (runnable ._run , file )
932
- spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function.py" ])
935
+ spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function.py" , file_path ])
933
936
else : # it could be tuple that includes pickle files with tasks and inputs
937
+ 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' )
934
941
ind , task_main_pkl , task_orig = runnable
935
- with open ('/pydra/pydra/engine/my_function.pkl' , 'wb' ) as file :
942
+ with open (file_path_1 , 'wb' ) as file :
936
943
pickle .dump (load_and_run , file )
937
- with open ('/pydra/pydra/engine/taskmain.pkl' , 'wb' ) as file :
944
+ with open (file_path_2 , 'wb' ) as file :
938
945
pickle .dump (task_main_pkl , file )
939
- with open ('/pydra/pydra/engine/ind.pkl' , 'wb' ) as file :
946
+ with open (file_path_3 , 'wb' ) as file :
940
947
pickle .dump (ind , file )
941
- spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function_2.py" ])
948
+ spec = self .make_spec ("python3.9" , ["/pydra/pydra/engine/run_pickled_function_2.py" , file_path_1 , file_path_2 , file_path_3 ])
942
949
943
950
job = self .make_job (spec , None )
944
951
jex .submit (job )
0 commit comments