From 7b36e6814cacf4b4b5928c9bf5e89a4f0af25074 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Tue, 16 Nov 2021 20:29:50 +0000 Subject: [PATCH] allow making the joiningfile allow the file to exist if force join is true --- binarycpython/utils/HPC.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/binarycpython/utils/HPC.py b/binarycpython/utils/HPC.py index a4916d0c0..a2a91176a 100644 --- a/binarycpython/utils/HPC.py +++ b/binarycpython/utils/HPC.py @@ -94,16 +94,18 @@ class HPC(condor,slurm): # check for joiningfile again if self.grid_options['HPC_force_join'] == 1: print("Forcing join because HPC_force_join is set") + x = True elif os.path.exists(joiningfile): if vb: print("cannot join: joiningfile exists at {}".format(joiningfile)) - return False + x = False elif vb: print("joiningfile does not exist : can join") + x = True if vb: - print("returning True from HPC_can_join()") - return True + print("returning {} from HPC_can_join()".format(x)) + return x def HPCjob(self): """ @@ -340,7 +342,10 @@ class HPC(condor,slurm): print("We can join") try: # touch joiningfile - pathlib.Path(joiningfile).touch(exist_ok=False) + if grid_options['HPC_force_join'] == 1: + pathlib.Path(joiningfile).touch(exist_ok=True) + else: + pathlib.Path(joiningfile).touch(exist_ok=False) try: self.HPC_join_from_files(self,joinfiles) except Exception as e: -- GitLab