diff --git a/beat/web/backend/management/commands/qsetup.py b/beat/web/backend/management/commands/qsetup.py index 48c4d3d474f7a31bf1303f0648ac8275490eb972..7d3a7f21e89c606f34bfd92a80a2b6d44802c562 100755 --- a/beat/web/backend/management/commands/qsetup.py +++ b/beat/web/backend/management/commands/qsetup.py @@ -42,7 +42,7 @@ import socket CORES = psutil.cpu_count() RAM = psutil.virtual_memory().total/(1024*1024) -ENVIRONMENT = {'name': 'Python 2.7', 'version': '1.1.0'} +ENVIRONMENT = {'name': 'Python 2.7', 'version': '1.2.0'} CXX_ENVIRONMENT = {'name': 'Cxx backend', 'version': '1.0.0'} ENVKEY = '%(name)s (%(version)s)' % ENVIRONMENT CXX_ENVKEY = '%(name)s (%(version)s)' % CXX_ENVIRONMENT diff --git a/beat/web/backend/tests/common.py b/beat/web/backend/tests/common.py index 6eca5672367fdc95511a842dfc124b81c148add9..943a70e40f0d511c13b23f2c57e668b4ad78a02a 100755 --- a/beat/web/backend/tests/common.py +++ b/beat/web/backend/tests/common.py @@ -62,7 +62,7 @@ ONE_QUEUE_TWO_WORKERS = { "cores-per-slot": 1, "max-slots-per-user": 2, "environments": [ - 'Python 2.7 (1.1.0)' + 'Python 2.7 (1.2.0)' ], "slots": { 'node1': { @@ -90,9 +90,9 @@ ONE_QUEUE_TWO_WORKERS = { } }, "environments": { - "Python 2.7 (1.1.0)": { + "Python 2.7 (1.2.0)": { "name": 'Python 2.7', - "version": '1.1.0', + "version": '1.2.0', "short_description": "Test", "description": "Test environment", "languages": "python", @@ -136,6 +136,9 @@ class BackendUtilitiesMixin(object): install.install_contributions(prefix, 'system', template_data) install.install_contributions(prefix, 'test', template_data) + if not os.path.exists(settings.CACHE_ROOT): + os.mkdir(settings.CACHE_ROOT) + def clean_cache(self): for p, dirs, files in os.walk(settings.CACHE_ROOT, topdown=False): diff --git a/beat/web/backend/tests/test_scheduler.py b/beat/web/backend/tests/test_scheduler.py index 59448d83a2847cd46de7bcc2a0f9c562bc3c23a7..3c87e06e627742246f92f883060776242129db57 100755 --- a/beat/web/backend/tests/test_scheduler.py +++ b/beat/web/backend/tests/test_scheduler.py @@ -32,7 +32,6 @@ from time import sleep from django.conf import settings from django.test import TransactionTestCase -from .common import BaseBackendTestCase from .common import BackendUtilitiesMixin from .common import ONE_QUEUE_TWO_WORKERS @@ -62,8 +61,14 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin): self.worker_threads = {} + @classmethod + def setUpTestData(cls): + cls.setup_test_data() + + def setUp(self): - self.tearDown() + self.shutdown_everything() + self.clean_cache() TestSchedulerBase.setup_test_data() setup_backend(ONE_QUEUE_TWO_WORKERS) @@ -71,6 +76,11 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin): def tearDown(self): + self.shutdown_everything() + self.clean_cache() + + + def shutdown_everything(self): for name in list(self.worker_threads.keys()): self.stop_worker(name) @@ -109,7 +119,9 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin): def check_worker_status(self, name, active): start = time() while Worker.objects.filter(name=name, active=active).count() == 0: - self.assertTrue(time() - start < 10) # Fail after 10 seconds + if time() - start > 10: # Fail after 10 seconds + self.shutdown_everything() + self.assertTrue(False) #---------------------------------------------------------- diff --git a/beat/web/backend/tests/test_setup.py b/beat/web/backend/tests/test_setup.py index 09498cc027380f0818d529f57e17d51f79de5dd0..4cc8bbb9e30605b70efde203378fe1e1a9e99927 100755 --- a/beat/web/backend/tests/test_setup.py +++ b/beat/web/backend/tests/test_setup.py @@ -52,7 +52,7 @@ QUEUES_WITHOUT_PRIORITY = { "time-limit": 180, #3 hours "cores-per-slot": 1, "max-slots-per-user": 4, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -69,7 +69,7 @@ QUEUES_WITHOUT_PRIORITY = { "time-limit": 360, #6 hours "cores-per-slot": 2, "max-slots-per-user": 2, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -86,7 +86,7 @@ QUEUES_WITHOUT_PRIORITY = { "time-limit": 720, #12 hours "cores-per-slot": 4, "max-slots-per-user": 1, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -106,9 +106,9 @@ QUEUES_WITHOUT_PRIORITY = { } }, "environments": { - 'Python 2.7 (1.1.0)': { + 'Python 2.7 (1.2.0)': { "name": 'Python 2.7', - "version": '1.1.0', + "version": '1.2.0', "short_description": "Test", "description": "Test environment", "languages": "python", @@ -124,7 +124,7 @@ PRIORITY_QUEUES = { "time-limit": 180, #3 hours "cores-per-slot": 1, "max-slots-per-user": 2, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -145,7 +145,7 @@ PRIORITY_QUEUES = { "time-limit": 360, #6 hours "cores-per-slot": 2, "max-slots-per-user": 1, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -166,7 +166,7 @@ PRIORITY_QUEUES = { "time-limit": 180, #3 hours "cores-per-slot": 1, "max-slots-per-user": 8, - "environments": ['Python 2.7 (1.1.0)'], + "environments": ['Python 2.7 (1.2.0)'], "groups": [ "Default", ], @@ -196,9 +196,9 @@ PRIORITY_QUEUES = { ) ]), "environments": { - 'Python 2.7 (1.1.0)': { + 'Python 2.7 (1.2.0)': { "name": 'Python 2.7', - "version": '1.1.0', + "version": '1.2.0', "short_description": "Test", "description": "Test environment", "languages": "python", @@ -284,7 +284,7 @@ class BackendSetup(BaseBackendTestCase): env = q1.environments.first() self.assertEqual(env.name, 'Python 2.7') - self.assertEqual(env.version, '1.1.0') + self.assertEqual(env.version, '1.2.0') self.assertEqual(q1.slots.count(), 1) self.assertEqual(q2.slots.count(), 1) @@ -393,7 +393,7 @@ class BackendSetup(BaseBackendTestCase): env = q1.environments.first() self.assertEqual(env.name, 'Python 2.7') - self.assertEqual(env.version, '1.1.0') + self.assertEqual(env.version, '1.2.0') self.assertEqual(q1.slots.count(), 2) self.assertEqual(q1_special.slots.count(), 2) diff --git a/beat/web/backend/views.py b/beat/web/backend/views.py index f4a3a90846b6526dfb9534b264e86d82544085e0..a6c2820a9f2192da3f7a830b0ac8ff676b5346c8 100755 --- a/beat/web/backend/views.py +++ b/beat/web/backend/views.py @@ -47,7 +47,6 @@ from ..experiments.models import Experiment from .models import Environment, Worker, Queue from . import state from . import utils -from . import schedule #------------------------------------------------