Skip to content

Commit 0e6283c

Browse files
committed
Merge pull request #105 from MarcCote/fix_nondeterministic_behavior
[FIX] use OrderedDict in PBS. [PEP8] replaced tabs with spaces.
2 parents abc32d2 + cbc9c93 commit 0e6283c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

smartdispatch/pbs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from collections import OrderedDict
23

34
regex_walltime = re.compile("(\d+:){1,4}")
45
regex_resource_nodes = re.compile("[a-zA-Z0-9]+(:ppn=\d+)?(:gpus=\d+)?(:[a-zA-Z0-9]+)*")
@@ -26,10 +27,10 @@ def __init__(self, queue_name, walltime):
2627
self.modules = []
2728
self.commands = []
2829

29-
self.resources = {}
30+
self.resources = OrderedDict()
3031
self.add_resources(walltime=walltime)
3132

32-
self.options = {}
33+
self.options = OrderedDict()
3334
self.add_options(q=queue_name)
3435

3536
# Declares that all environment variables in the qsub command's environment are to be exported to the batch job.

smartdispatch/tests/test_pbs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def test_add_commands(self):
7272
def test_str(self):
7373
# Create simple PBS file
7474
expected = """#!/bin/bash
75-
#PBS -V
7675
#PBS -q qtest@mp2
76+
#PBS -V
7777
#PBS -l walltime=01:00:00
7878
7979
# Modules #
@@ -90,11 +90,11 @@ def test_str(self):
9090
modules = ["CUDA_Toolkit/6.0", "python2.7"]
9191

9292
expected = """#!/bin/bash
93-
#PBS -A xyz-123-ab
94-
#PBS -V
9593
#PBS -q qtest@mp2
96-
#PBS -l nodes=2:ppn=3:gpus=1
94+
#PBS -V
95+
#PBS -A xyz-123-ab
9796
#PBS -l walltime=01:00:00
97+
#PBS -l nodes=2:ppn=3:gpus=1
9898
9999
# Modules #
100100
module load CUDA_Toolkit/6.0

tests/test_smart_dispatch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def test_main_resume(self):
6262

6363
# Test when batch_uid is a path instead of a jobname.
6464
# Setup
65-
call(self.launch_command, shell=True)
6665
batch_uid = os.path.join(self.logs_dir, os.listdir(self.logs_dir)[0])
6766

6867
# Simulate that some commands are in the running state.

0 commit comments

Comments
 (0)