Skip to content

Commit

Permalink
Bugfix - dictionary modified instead of copied
Browse files Browse the repository at this point in the history
There was a bug where a value was been added to a dictionary
unnecessarily, however this was only causing a problem as it was
updating the original dictionary. This commit removes both these issues
by removing the offending line of code, and by copying the resulting
dictionary when working on the values contained within.

Additionally this means that this now works on artemis completing #7
  • Loading branch information
malramsay64 committed Feb 15, 2018
1 parent b5b665f commit ff7d78a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/experi/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""

from typing import Any, List, Union, Mapping
from copy import deepcopy
from collections import ChainMap, OrderedDict
import logging

Expand Down Expand Up @@ -125,7 +126,8 @@ def pbs_header(**kwargs):

# Parse arbitrary options
for key, val in kwargs.items():
header_string += '#PBS -{} {}\n'.format(key, val)
logger.warning('Arbitrary key passed: %s', key)
# header_string += '#PBS -{} {}\n'.format(key, val)

return header_string

Expand All @@ -139,6 +141,7 @@ def create_pbs_file(command_group: List[str],
default options.
"""
pbs_options = deepcopy(pbs_options)
try:
setup_string = parse_setup(pbs_options['setup'])
del pbs_options['setup']
Expand All @@ -153,7 +156,6 @@ def create_pbs_file(command_group: List[str],
header_string += '#PBS -J 0-{}\n'.format(num_jobs-1)
else:
header_string += 'PBS_ARRAY_INDEX=0\n'
pbs_options['command_list'] = commands2bash_array(command_group)
return header_string + PBS_TEMPLATE.format(
command_list=commands2bash_array(command_group),
setup=setup_string,
Expand Down

0 comments on commit ff7d78a

Please sign in to comment.