From 24748d6d13a21619c38a96701295d486af26193b Mon Sep 17 00:00:00 2001 From: Yuman Hordijk Date: Tue, 12 Mar 2024 16:12:09 +0100 Subject: [PATCH 1/2] We are now writing the output of a job to a file --- src/tcutility/job/generic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tcutility/job/generic.py b/src/tcutility/job/generic.py index 3c0ead8a..76ba6dff 100644 --- a/src/tcutility/job/generic.py +++ b/src/tcutility/job/generic.py @@ -142,7 +142,8 @@ def run(self): else: # if we are not using slurm, we can execute the file. For this we need special permissions, so we have to set that first. os.chmod(self.runfile_path, stat.S_IRWXU) - sp.run(self.runfile_path, cwd=os.path.split(self.runfile_path)[0]) + with open(f'{self.name}.out', 'w+') as out: + sp.run(self.runfile_path, cwd=os.path.split(self.runfile_path)[0], stdout=out) def add_preamble(self, line: str): ''' From cbee4945a633d94c9b2e364572887c9cf5439967 Mon Sep 17 00:00:00 2001 From: Yuman Hordijk Date: Tue, 12 Mar 2024 16:13:35 +0100 Subject: [PATCH 2/2] The path we were writing to was not correct --- src/tcutility/job/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tcutility/job/generic.py b/src/tcutility/job/generic.py index 76ba6dff..86f087b5 100644 --- a/src/tcutility/job/generic.py +++ b/src/tcutility/job/generic.py @@ -142,7 +142,7 @@ def run(self): else: # if we are not using slurm, we can execute the file. For this we need special permissions, so we have to set that first. os.chmod(self.runfile_path, stat.S_IRWXU) - with open(f'{self.name}.out', 'w+') as out: + with open(f'{os.path.split(self.runfile_path)[0]}/{self.name}.out', 'w+') as out: sp.run(self.runfile_path, cwd=os.path.split(self.runfile_path)[0], stdout=out) def add_preamble(self, line: str):