diff options
author | jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-03-02 22:23:44 +0000 |
---|---|---|
committer | jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-03-02 22:23:44 +0000 |
commit | 9af122ddedd0ce4f1ae430551bffd5da5557f2b1 (patch) | |
tree | 745999844c695d6f9559514effe39134749a3018 /scheduler | |
parent | a08c24b77e56398e586bc00c65e3ce550af3cf92 (diff) |
Abstract out common models used in the frontend's models.py so that django is not required to interact with non Django portions of the code.
This includes the enums RebootBefore, RebootAfter and Test.Type
git-svn-id: svn://test.kernel.org/autotest/trunk@4280 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'scheduler')
-rwxr-xr-x | scheduler/monitor_db.py | 5 | ||||
-rwxr-xr-x | scheduler/monitor_db_functional_test.py | 15 | ||||
-rwxr-xr-x | scheduler/scheduler_models_unittest.py | 6 |
3 files changed, 14 insertions, 12 deletions
diff --git a/scheduler/monitor_db.py b/scheduler/monitor_db.py index 86dd5358..05ee09ca 100755 --- a/scheduler/monitor_db.py +++ b/scheduler/monitor_db.py @@ -21,6 +21,7 @@ from autotest_lib.client.common_lib import global_config, logging_manager from autotest_lib.client.common_lib import host_protections, utils from autotest_lib.database import database_connection from autotest_lib.frontend.afe import models, rpc_utils, readonly_connection +from autotest_lib.frontend.afe import model_attributes from autotest_lib.scheduler import drone_manager, drones, email_manager from autotest_lib.scheduler import monitor_db_cleanup from autotest_lib.scheduler import status_server, scheduler_config @@ -2354,8 +2355,8 @@ class GatherLogsTask(PostJobTask): do_reboot = ( # always reboot after aborted jobs self._final_status() == models.HostQueueEntry.Status.ABORTED - or reboot_after == models.RebootAfter.ALWAYS - or (reboot_after == models.RebootAfter.IF_ALL_TESTS_PASSED + or reboot_after == model_attributes.RebootAfter.ALWAYS + or (reboot_after == model_attributes.RebootAfter.IF_ALL_TESTS_PASSED and final_success and num_tests_failed == 0)) for queue_entry in self.queue_entries: diff --git a/scheduler/monitor_db_functional_test.py b/scheduler/monitor_db_functional_test.py index afe25b5b..2f134147 100755 --- a/scheduler/monitor_db_functional_test.py +++ b/scheduler/monitor_db_functional_test.py @@ -6,6 +6,7 @@ from autotest_lib.client.common_lib import enum, global_config, host_protections from autotest_lib.database import database_connection from autotest_lib.frontend import setup_django_environment from autotest_lib.frontend.afe import frontend_test_utils, models +from autotest_lib.frontend.afe import model_attributes from autotest_lib.scheduler import drone_manager, email_manager, monitor_db from autotest_lib.scheduler import scheduler_models @@ -415,7 +416,7 @@ class SchedulerFunctionalTest(unittest.TestCase, def _setup_for_pre_job_cleanup(self): self._initialize_test() job, queue_entry = self._make_job_and_queue_entry() - job.reboot_before = models.RebootBefore.ALWAYS + job.reboot_before = model_attributes.RebootBefore.ALWAYS job.save() return queue_entry @@ -480,7 +481,7 @@ class SchedulerFunctionalTest(unittest.TestCase, def _setup_for_post_job_cleanup(self): self._initialize_test() job, queue_entry = self._make_job_and_queue_entry() - job.reboot_after = models.RebootAfter.ALWAYS + job.reboot_after = model_attributes.RebootAfter.ALWAYS job.save() return queue_entry @@ -592,7 +593,7 @@ class SchedulerFunctionalTest(unittest.TestCase, def test_do_not_verify_job_with_cleanup(self): queue_entry = self._setup_for_do_not_verify() - queue_entry.job.reboot_before = models.RebootBefore.ALWAYS + queue_entry.job.reboot_before = model_attributes.RebootBefore.ALWAYS queue_entry.job.save() self._run_dispatcher() # cleanup @@ -603,7 +604,7 @@ class SchedulerFunctionalTest(unittest.TestCase, def test_do_not_verify_pre_job_cleanup_failure(self): queue_entry = self._setup_for_do_not_verify() - queue_entry.job.reboot_before = models.RebootBefore.ALWAYS + queue_entry.job.reboot_before = model_attributes.RebootBefore.ALWAYS queue_entry.job.save() self._run_dispatcher() # cleanup @@ -761,7 +762,7 @@ class SchedulerFunctionalTest(unittest.TestCase, self._initialize_test() job, queue_entry = self._make_job_and_queue_entry() job.run_verify = False - job.reboot_after = models.RebootAfter.NEVER + job.reboot_after = model_attributes.RebootAfter.NEVER job.save() self._run_dispatcher() # launches job @@ -948,7 +949,7 @@ class SchedulerFunctionalTest(unittest.TestCase, job = self._create_job(hosts=[1,2], synchronous=True) queue_entry = job.hostqueueentry_set.all()[0] job.run_verify = False - job.reboot_after = models.RebootAfter.NEVER + job.reboot_after = model_attributes.RebootAfter.NEVER job.save() self.mock_drone_manager.process_capacity = 0 @@ -1030,7 +1031,7 @@ class SchedulerFunctionalTest(unittest.TestCase, def test_pre_job_keyvals(self): job = self._create_job(hosts=[1]) job.run_verify = False - job.reboot_before = models.RebootBefore.NEVER + job.reboot_before = model_attributes.RebootBefore.NEVER job.save() models.JobKeyval.objects.create(job=job, key='mykey', value='myvalue') diff --git a/scheduler/scheduler_models_unittest.py b/scheduler/scheduler_models_unittest.py index 60ff4b3b..df7fe359 100755 --- a/scheduler/scheduler_models_unittest.py +++ b/scheduler/scheduler_models_unittest.py @@ -7,7 +7,7 @@ from autotest_lib.frontend.afe import frontend_test_utils from autotest_lib.client.common_lib.test_utils import mock from autotest_lib.client.common_lib.test_utils import unittest from autotest_lib.database import database_connection -from autotest_lib.frontend.afe import models +from autotest_lib.frontend.afe import models, model_attributes from autotest_lib.scheduler import monitor_db_functional_test from autotest_lib.scheduler import scheduler_models @@ -363,7 +363,7 @@ class JobTest(BaseSchedulerModelsTest): def test_reboot_before_always(self): job = self._create_job(hosts=[1]) - job.reboot_before = models.RebootBefore.ALWAYS + job.reboot_before = model_attributes.RebootBefore.ALWAYS job.save() task = self._test_pre_job_tasks_helper() @@ -373,7 +373,7 @@ class JobTest(BaseSchedulerModelsTest): def _test_reboot_before_if_dirty_helper(self, expect_reboot): job = self._create_job(hosts=[1]) - job.reboot_before = models.RebootBefore.IF_DIRTY + job.reboot_before = model_attributes.RebootBefore.IF_DIRTY job.save() task = self._test_pre_job_tasks_helper() |