From d74b596defc4a76cb01eb0691e97425f03ab10f7 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 6 Feb 2024 14:16:28 +0100 Subject: [PATCH] ref: remove unnecessary if levels --- config.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/config.py b/config.py index dd18ebdd..06b528c6 100644 --- a/config.py +++ b/config.py @@ -375,19 +375,18 @@ def get_dep_ids(self, job_name, add_dep=None): def get_dep_cmd(self, job_name, add_dep=None): """Generate the part of the sbatch command that sepcifies dependencies for `job_name`""" - if not self.force_sync: - # Default: async case - if dep_ids := self.get_dep_ids(job_name, add_dep=add_dep): - dep_str = ':'.join(map(str, dep_ids)) - return f'--dependency=afterok:{dep_str}' - else: - # job_name has no dependencies but still belongs to an async workflow - # so don't use --wait - return None - else: - # Needed for nested run_chain.py + # Needed for nested run_chain.py + if self.force_sync: return '--wait' + if dep_ids := self.get_dep_ids(job_name, add_dep=add_dep): + dep_str = ':'.join(map(str, dep_ids)) + return f'--dependency=afterok:{dep_str}' + + # job_name has no dependencies but still belongs to an async workflow + # so don't use --wait + return None + def submit(self, job_name, script, add_dep=None): """Submit job with dependencies""" script_path = Path(script)