Skip to content

Commit

Permalink
Fixing bug where multiple dependencies would overwrite each other, th…
Browse files Browse the repository at this point in the history
…us causing only one dependency to be active.
  • Loading branch information
LandonTClipp committed Jul 11, 2018
1 parent fbcf671 commit ee27aea
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion batch4py/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ torque:
ppn: 'ppn={}'
node_type: '{}'
account: '-A'
depend: '-W depend={}'
attribute: '-W'
walltime: '-l walltime={}'
delimit: ':'
job_name: '-N'
Expand Down
26 changes: 24 additions & 2 deletions batch4py/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,31 @@ def submit( self, dry_run = False, stdout=None, stderr=None ):
# Add extra commands
args = args + self._extra_cmd

deptype = {}
# Add PBS dependencies
for dep in self.dependents:
args.append( self.config['depend'].format( dep[1] + self.config['delimit'] + dep[0].get_sched_id() ) )
if self.dependents:
args.append( self.config['attribute'] )
for dep in self.dependents:

# Add list to this key if we haven't seen it before
if dep[1] not in deptype:
deptype[dep[1]] = []

# Append to the list
deptype[ dep[1] ].append( dep[0] )

dep_str = ""
for type in deptype:
if dep_str:
dep_str = dep_str + ","
else:
dep_str = "depend="

dep_str = dep_str + type
for dep in deptype[type]:
dep_str = "{}{}{}".format( dep_str, self.config['delimit'], dep.get_sched_id())

args.append( dep_str )

# Add node requirements
if self.nodes:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
setup(
name='batch4py',
version='0.2.3',
version='0.2.4',
author='Landon T. Clipp',
author_email='[email protected]',
packages=['batch4py'],
Expand All @@ -13,7 +13,7 @@
qsub and allows for users to define complex job chains.',
install_requires=[ 'pyyaml' ],
url = 'https://github.com/TerraFusion/batch4py',
download_url='https://github.com/TerraFusion/batch4py/archive/0.2.2.tar.gz',
download_url='https://github.com/TerraFusion/batch4py/archive/0.2.4.tar.gz',
keywords = ['batch', 'torque', 'pbs', 'pbs-torque', 'hpc', 'python', 'python3', 'cluster',
'scheduler', 'schedule' ],
package_data = {'batch4py': [ os.path.join( '.', 'batch4py', 'config.yml') ] },
Expand Down

0 comments on commit ee27aea

Please sign in to comment.