Skip to content

Commit

Permalink
ref: remove unnecessary if levels
Browse files Browse the repository at this point in the history
  • Loading branch information
leclairm committed Feb 6, 2024
1 parent ff84565 commit d74b596
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d74b596

Please sign in to comment.