File tree Expand file tree Collapse file tree 4 files changed +16
-14
lines changed
Expand file tree Collapse file tree 4 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ NO_ET=TRUE
77docker pull $DOCKER_IMAGE
88
99# Start image
10- docker run -itd -h slurmctl --cap-add sys_admin -d --name slurm -v $PKG_DIR :/pydra -e NO_ET=$NO_ET $DOCKER_IMAGE
10+ docker run --rm - itd -h slurmctl --cap-add sys_admin -d --name slurm -v $PKG_DIR :/pydra -e NO_ET=$NO_ET $DOCKER_IMAGE
1111
1212# Display previous jobs with sacct
1313echo " Allowing ports/daemons time to start" && sleep 10
Original file line number Diff line number Diff line change 1- import pickle
1+ import cloudpickle as cp
22import sys
3+ from pathlib import Path
34from pydra .engine .helpers import load_and_run
45
6+ # To avoid issues when running pytest, where the namespace package "pydra" is dropped in
7+ # the pickling process due to it being run from inside the source tree
8+ sys .path .append (str (Path (__file__ ).parent .parent ))
9+
510
611def run_pickled (* file_paths , rerun = False ):
712 loaded_objects = []
813
914 for file_path in file_paths :
1015 with open (file_path , "rb" ) as file :
11- loaded_objects .append (pickle .load (file ))
16+ loaded_objects .append (cp .load (file ))
1217
1318 if len (loaded_objects ) == 1 :
1419 result = loaded_objects [0 ](rerun = rerun )
Original file line number Diff line number Diff line change 1010import pytest
1111from pydra .design import workflow
1212from fileformats .generic import Directory
13+ from pydra .engine .core import Task
14+ from pydra .engine .submitter import Submitter
15+ from pydra .engine .workers import DebugWorker
16+ from pydra .design import python
17+ from pathlib import Path
18+ from datetime import datetime
19+ from pydra .engine .specs import Result
1320from .utils import (
1421 need_sge ,
1522 need_slurm ,
1623 BasicWorkflow ,
1724 BasicWorkflowWithThreadCount ,
1825 BasicWorkflowWithThreadCountConcurrent ,
1926)
20- from ..core import Task
21- from ..submitter import Submitter
22- from ..workers import DebugWorker
23- from pydra .design import python
24- from pathlib import Path
25- from datetime import datetime
26- from pydra .engine .specs import Result
2727
2828
2929@python .define
Original file line number Diff line number Diff line change @@ -974,16 +974,13 @@ async def run(
974974 -------
975975 None
976976 """
977- import pickle
978- from pathlib import Path
979-
980977 jex = self .psij .JobExecutor .get_instance (self .subtype )
981978 absolute_path = Path (__file__ ).parent
982979
983980 cache_dir = task .cache_dir
984981 file_path = cache_dir / "runnable_function.pkl"
985982 with open (file_path , "wb" ) as file :
986- pickle .dump (task .run , file )
983+ cp .dump (task .run , file )
987984 func_path = absolute_path / "run_pickled.py"
988985 spec = self .make_spec ("python" , [func_path , file_path ])
989986
You can’t perform that action at this time.
0 commit comments