Skip to content
Snippets Groups Projects
Commit 45c14b64 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[backend] Test and fix scheduler re-assignment

parent 93e40757
No related branches found
No related tags found
1 merge request!194Scheduler
...@@ -71,7 +71,8 @@ def _select_splits_for_queue(queue): ...@@ -71,7 +71,8 @@ def _select_splits_for_queue(queue):
''' '''
splits = JobSplit.objects.filter(job__block__queue=queue, splits = JobSplit.objects.filter(job__block__queue=queue,
job__split_errors=0, status=Job.QUEUED).order_by('job__runnable_date') worker__isnull=True, job__split_errors=0,
status=Job.QUEUED).order_by('job__runnable_date')
# lists of all users currently running # lists of all users currently running
users = set(splits.values_list('job__block__experiment__author', flat=True)) users = set(splits.values_list('job__block__experiment__author', flat=True))
......
...@@ -840,6 +840,25 @@ class Scheduling(BaseBackendTestCase): ...@@ -840,6 +840,25 @@ class Scheduling(BaseBackendTestCase):
self.assertEqual(worker.available_cores(), qsetup.CORES) self.assertEqual(worker.available_cores(), qsetup.CORES)
def test_does_not_reassign(self):
# tests if the scheduling routine never re-assigns splits which are
# already assigned.
fullname = 'user/user/single/1/single'
xp = Experiment.objects.get(name=fullname.split(os.sep)[-1])
# schedules the experiment and check it
xp.schedule()
self.check_single(xp)
assigned_splits = schedule()
self.assertEqual(len(assigned_splits), 1)
assigned_splits = schedule()
self.assertEqual(len(assigned_splits), 0)
def test_worker_activation(self): def test_worker_activation(self):
# tests that scheduling depends on worker activation # tests that scheduling depends on worker activation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment