def configure(self, config_file): config_url = 'config:' + config_file cwd = os.getcwd() self.config = appconfig(config_url, 'MAGMaWeb', relative_to=cwd) engine = engine_from_config(self.config) init_user_db(engine) self.job_factory = make_job_factory(self.config)
def __init__(self, job, request): """View callable with job and request as arguments""" self.job = job self.request = request self.job_factory = make_job_factory(request.registry.settings) self.restricted = self.request.registry.settings['restricted'] self.ncpus = self.request.registry.settings['ncpus']
def test_local(self): settings = {'jobfactory.root_dir': '/somedir', 'jobfactory.init_script': '. /somedir/env/bin/activate' } factory = make_job_factory(settings) self.assertEqual(factory.root_dir, '/somedir') self.assertEqual(factory.init_script, '. /somedir/env/bin/activate') self.assertEqual(factory.tarball, None)
def setUp(self): FunctionalTests.setUp(self) # Setup owner of job jf = make_job_factory(self.settings) with transaction.manager: user = User('bob', 'Bob Example', '*****@*****.**', 'mypassword') DBSession().add(user) self.job = jf.fromScratch('bob') self.jobid = self.job.id
def setUp(self): FunctionalTests.setUp(self) # Setup owner of job jf = make_job_factory(self.settings) with transaction.manager: user = User(u"bob", u"Bob Example", u"*****@*****.**", "mypassword") DBSession().add(user) self.job = jf.fromScratch(u"bob") self.jobid = self.job.id
def test_remote(self): settings = {'jobfactory.root_dir': '/somedir', 'jobfactory.init_script': 'tar -zxf Magma.tar.gz;', 'jobfactory.tarball': '/somepath/Magma.tar.gz' } factory = make_job_factory(settings) self.assertEqual(factory.root_dir, '/somedir') self.assertEqual(factory.init_script, 'tar -zxf Magma.tar.gz;') self.assertEqual(factory.tarball, '/somepath/Magma.tar.gz')
def __init__(self, request): super(JobIdFactory, self).__init__(request) from magmaweb.job import make_job_factory self.job_factory = make_job_factory(request.registry.settings)
def __init__(self, request): self.request = request self.job_factory = make_job_factory(request.registry.settings)
def test_minimal(self): factory = make_job_factory({'jobfactory.root_dir': '/somedir'}) self.assertEqual(factory.root_dir, '/somedir') self.assertEqual(factory.init_script, '') self.assertEqual(factory.tarball, None)
def test_norootdir(self): with self.assertRaises(TypeError): make_job_factory({})