Skip to content

Commit

Permalink
Small changes in TestSlurmQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
aalitaiga committed Oct 11, 2017
1 parent b2c17a3 commit 5bd3c86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions smartdispatch/tests/test_job_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,15 @@ def setUp(self):
self.dummy_pbs = dummy_generator.pbs_list

def test_ppn_ncpus(self):
assert_true("ppn" not in str(self.pbs[0]))
assert_true("ncpus" in str(self.pbs[0]))
assert_true("ppn" in str(self.dummy_pbs[0]))
assert_true("ncpus" not in str(self.dummy_pbs[0]))
assert_true("ppn" not in str(self.pbs[0]))
assert_true("ncpus" in str(self.pbs[0]))


def test_gpus_naccelerators(self):
assert_true("gpus" in str(self.dummy_pbs[0]))
assert_true("naccelerators" not in str(self.dummy_pbs[0]))
assert_true("gpus" not in str(self.pbs[0]))
assert_true("naccelerators" in str(self.pbs[0]))

Expand Down
3 changes: 1 addition & 2 deletions smartdispatch/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import unittest
try:
from mock import patch
import mock
except ImportError:
from unittest.mock import patch
import unittest.mock

from nose.tools import assert_equal, assert_true
from numpy.testing import assert_array_equal
import subprocess
Expand Down
5 changes: 4 additions & 1 deletion smartdispatch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ def detect_cluster():
return cluster_name

def get_slurm_cluster_name():
stdout = Popen("sacctmgr list cluster", stdout=PIPE, shell=True).communicate()[0]
try:
stdout = Popen("sacctmgr list cluster", stdout=PIPE, shell=True).communicate()[0]
except OSError:
return None
stdout = stdout.decode()
cluster_name = stdout.splitlines()[2].strip().split(' ')[0]
return cluster_name
Expand Down

0 comments on commit 5bd3c86

Please sign in to comment.