Skip to content

Commit

Permalink
Fix #87 and unrelated bug
Browse files Browse the repository at this point in the history
There was a bug in submitting with multiple dependencies in torque (#87)
and another with handling torque job ids in the format
'node08/1,4-6' — comma handling was not implemented.
  • Loading branch information
MikeDacre committed Feb 9, 2018
1 parent a7eb2b8 commit ad253cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions fyrd/batch_systems/torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ def submit(file_name, dependencies=None, job=None, args=None, kwds=None):
"""
_logme.log('Submitting to torque', 'debug')
if dependencies:
deps = '-W depend={}'.format(
','.join(['afterok:' + str(d) for d in dependencies]))
deps = '-W depend=afterok:{}'.format(
':'.join([str(d) for d in dependencies])
)
args = ['qsub', deps, file_name]
else:
args = ['qsub', file_name]
Expand Down Expand Up @@ -311,10 +312,16 @@ def queue_parser(user=None, partition=None):
nodes = []
# Convert node range to individual nodes in list
for node in nds:
if '-' in node:
nm, num = node.split('/')
for i in range(*[int(i) for i in num.split('-')]):
nodes.append(nm + '/' + str(i).zfill(2))
if '/' in node:
nm, nums = node.split('/')
for num in nums.split(','):
if '-' in num:
nstart, nend = [int(i) for i in num.split('-')]
else:
nstart = nend = int(num)
nend += 1
for i in range(nstart, nend):
nodes.append(nm + '/' + str(i).zfill(2))
else:
nodes.append(node)
# I assume that every 'node' is a core, as that is the
Expand Down
2 changes: 1 addition & 1 deletion tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_depends():
assert job2.stdout == 'eggs\n'
assert job2.stderr == ''
job3 = fyrd.Job('echo cheese', profile='default', clean_files=True,
clean_outputs=True, depends=job2.id).submit()
clean_outputs=True, depends=[job, job2.id]).submit()
out = job3.get()
assert out == 'cheese\n'
assert job3.stdout == 'cheese\n'
Expand Down

0 comments on commit ad253cd

Please sign in to comment.