def __init__(self, np=1, reason=None, label=None): self.np = np self.reason = reason self.label = label + '_' + time.strftime("%d%m%y-%H%M%S") if self.np > 1: self.launchmode = DistributedLaunchMode(self.np) self.executable = sumatra.programs.Executable(path="mpirun") else: self.launchmode = SerialLaunchMode() self.executable = sumatra.programs.PythonExecutable( path=sys.executable)
class TestSerialLaunchMode(unittest.TestCase, BaseTestLaunchMode): def setUp(self): self.lm = SerialLaunchMode() def tearDown(self): for path in "valid_test_script.py", "invalid_test_script.py", "test_parameters": if os.path.exists(path): os.remove(path) def test__get_platform_information__should_return_a_list_of_PlatformInformation_objects(self): pis = self.lm.get_platform_information() pi0 = pis[0] import platform self.assertEqual(pi0.version, platform.version()) def test__equality(self): new_lm = SerialLaunchMode() self.assertEqual(self.lm, new_lm) assert self.lm != 42
def setUp(self): self.lm = SerialLaunchMode()
from sumatra.projects import Project from sumatra.records import Record from sumatra.recordstore import django_store from sumatra.programs import PythonExecutable from sumatra.launch import SerialLaunchMode from sumatra.datastore import FileSystemDataStore from sumatra.parameters import SimpleParameterSet from sumatra.versioncontrol._git import GitRepository import random from datetime import datetime serial = SerialLaunchMode() executable = PythonExecutable("/usr/bin/python", version="2.7") repos = GitRepository('.') datastore = FileSystemDataStore("/path/to/datastore") project = Project("test_project", default_executable=executable, default_repository=repos, default_launch_mode=serial, data_store=datastore, record_store=django_store.DjangoRecordStore()) parameters = SimpleParameterSet({'a': 2, 'b': 3}) for i in range(50): record = Record(executable=executable, repository=repos, main_file="main.py", version="99863a9dc5f", launch_mode=serial, datastore=datastore, parameters=parameters, input_data=[], script_arguments="", label="fake_record%00d" % i, reason="testing", diff='', user='******', on_changed='store-diff', stdout_stderr='srgvrgvsgverhcser')
def test__equality(self): new_lm = SerialLaunchMode() self.assertEqual(self.lm, new_lm) assert self.lm != 42
from __future__ import unicode_literals from builtins import range from sumatra.projects import Project from sumatra.records import Record from sumatra.recordstore import django_store from sumatra.programs import PythonExecutable from sumatra.launch import SerialLaunchMode from sumatra.datastore import FileSystemDataStore from sumatra.parameters import SimpleParameterSet from sumatra.versioncontrol._git import GitRepository import random serial = SerialLaunchMode() executable = PythonExecutable("/usr/bin/python", version="2.7") repos = GitRepository('.') datastore = FileSystemDataStore("/path/to/datastore") project = Project("test_project", default_executable=executable, default_repository=repos, default_launch_mode=serial, data_store=datastore, record_store=django_store.DjangoRecordStore()) parameters = SimpleParameterSet({'a': 2, 'b': 3}) for i in range(50): record = Record(executable=executable, repository=repos, main_file="main.py", version="99863a9dc5f", launch_mode=serial, datastore=datastore,