Skip to content

Commit 86b4377

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d9bca02 commit 86b4377

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

pydra/engine/run_pickled_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def run_pickled():
77
file_path = sys.argv[1]
8-
with open(file_path, 'rb') as file:
8+
with open(file_path, "rb") as file:
99
loaded_function = pickle.load(file)
1010

1111
result = loaded_function(rerun=False)

pydra/engine/run_pickled_function_2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ def run_pickled():
77
file_path_1 = sys.argv[1]
88
file_path_2 = sys.argv[2]
99
file_path_3 = sys.argv[3]
10-
with open(file_path_1, 'rb') as file:
10+
with open(file_path_1, "rb") as file:
1111
loaded_function = pickle.load(file)
12-
with open(file_path_2, 'rb') as file:
12+
with open(file_path_2, "rb") as file:
1313
taskmain = pickle.load(file)
14-
with open(file_path_3, 'rb') as file:
14+
with open(file_path_3, "rb") as file:
1515
ind = pickle.load(file)
1616

1717
result = loaded_function(taskmain, ind, rerun=False)

pydra/engine/workers.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -924,28 +924,39 @@ async def exec_psij(self, runnable, rerun=False):
924924
import psij
925925
import pickle
926926
import os
927+
927928
self.psij = psij
928-
jex = psij.JobExecutor.get_instance('slurm')
929-
929+
jex = psij.JobExecutor.get_instance("slurm")
930+
930931
if isinstance(runnable, TaskBase):
931932
cache_dir = runnable.cache_dir
932-
file_path = os.path.join(cache_dir, 'my_function.pkl')
933-
with open(file_path, 'wb') as file:
933+
file_path = os.path.join(cache_dir, "my_function.pkl")
934+
with open(file_path, "wb") as file:
934935
pickle.dump(runnable._run, file)
935-
spec = self.make_spec("python3.9", ["/pydra/pydra/engine/run_pickled_function.py", file_path])
936+
spec = self.make_spec(
937+
"python3.9", ["/pydra/pydra/engine/run_pickled_function.py", file_path]
938+
)
936939
else: # it could be tuple that includes pickle files with tasks and inputs
937940
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")
941944
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:
943946
pickle.dump(load_and_run, file)
944-
with open(file_path_2, 'wb') as file:
947+
with open(file_path_2, "wb") as file:
945948
pickle.dump(task_main_pkl, file)
946-
with open(file_path_3, 'wb') as file:
949+
with open(file_path_3, "wb") as file:
947950
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+
spec = self.make_spec(
952+
"python3.9",
953+
[
954+
"/pydra/pydra/engine/run_pickled_function_2.py",
955+
file_path_1,
956+
file_path_2,
957+
file_path_3,
958+
],
959+
)
949960

950961
job = self.make_job(spec, None)
951962
jex.submit(job)

0 commit comments

Comments
 (0)