Skip to content

Commit ee27aea

Browse files
author
LandonTClipp
committed
Fixing bug where multiple dependencies would overwrite each other, thus causing only one dependency to be active.
1 parent fbcf671 commit ee27aea

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

batch4py/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ torque:
77
ppn: 'ppn={}'
88
node_type: '{}'
99
account: '-A'
10-
depend: '-W depend={}'
10+
attribute: '-W'
1111
walltime: '-l walltime={}'
1212
delimit: ':'
1313
job_name: '-N'

batch4py/job.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,31 @@ def submit( self, dry_run = False, stdout=None, stderr=None ):
266266
# Add extra commands
267267
args = args + self._extra_cmd
268268

269+
deptype = {}
269270
# Add PBS dependencies
270-
for dep in self.dependents:
271-
args.append( self.config['depend'].format( dep[1] + self.config['delimit'] + dep[0].get_sched_id() ) )
271+
if self.dependents:
272+
args.append( self.config['attribute'] )
273+
for dep in self.dependents:
274+
275+
# Add list to this key if we haven't seen it before
276+
if dep[1] not in deptype:
277+
deptype[dep[1]] = []
278+
279+
# Append to the list
280+
deptype[ dep[1] ].append( dep[0] )
281+
282+
dep_str = ""
283+
for type in deptype:
284+
if dep_str:
285+
dep_str = dep_str + ","
286+
else:
287+
dep_str = "depend="
288+
289+
dep_str = dep_str + type
290+
for dep in deptype[type]:
291+
dep_str = "{}{}{}".format( dep_str, self.config['delimit'], dep.get_sched_id())
292+
293+
args.append( dep_str )
272294

273295
# Add node requirements
274296
if self.nodes:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
setup(
55
name='batch4py',
6-
version='0.2.3',
6+
version='0.2.4',
77
author='Landon T. Clipp',
88
author_email='[email protected]',
99
packages=['batch4py'],
@@ -13,7 +13,7 @@
1313
qsub and allows for users to define complex job chains.',
1414
install_requires=[ 'pyyaml' ],
1515
url = 'https://github.com/TerraFusion/batch4py',
16-
download_url='https://github.com/TerraFusion/batch4py/archive/0.2.2.tar.gz',
16+
download_url='https://github.com/TerraFusion/batch4py/archive/0.2.4.tar.gz',
1717
keywords = ['batch', 'torque', 'pbs', 'pbs-torque', 'hpc', 'python', 'python3', 'cluster',
1818
'scheduler', 'schedule' ],
1919
package_data = {'batch4py': [ os.path.join( '.', 'batch4py', 'config.yml') ] },

0 commit comments

Comments
 (0)