コード例 #1
0
ファイル: utils.py プロジェクト: goldenhelix/avocado
    def test_create_and_cancel(self):
        # Create 3 meaningless jobs. We're just testing job setup and
        # cancellation here, not the execution.
        utils.async_get_result_rows(None, None, {})
        job_options = {
            'name': 'Job X',
        }
        job_x_id = utils.async_get_result_rows(None, None, {}, job_options)
        job_options = {
            'name': 'Job Y',
            'query_name': 'job_y_query',
        }
        job_y_id = utils.async_get_result_rows(None, None, {}, job_options)

        self.assertEqual(async_utils.get_job_count(), 3)

        jobs = async_utils.get_jobs()
        self.assertEqual(len(jobs), 3)

        job_x = async_utils.get_job(job_x_id)
        self.assertTrue(job_x in jobs)
        self.assertEqual(job_x.meta['name'], 'Job X')

        self.assertEqual(async_utils.cancel_job(job_x_id), None)
        self.assertEqual(async_utils.get_job_count(), 2)
        async_utils.cancel_job('invalid_id')
        self.assertEqual(async_utils.get_job_count(), 2)

        self.assertTrue('canceled' in async_utils.cancel_job(job_y_id))
        self.assertTrue(async_utils.get_job_count(), 1)

        async_utils.cancel_all_jobs()
        self.assertEqual(async_utils.get_job_count(), 0)
コード例 #2
0
    def test_create_and_cancel(self):
        # Create 3 meaningless jobs. We're just testing job setup and
        # cancellation here, not the execution.
        utils.async_get_result_rows(None, None, {})
        job_options = {
            'name': 'Job X',
        }
        job_x_id = utils.async_get_result_rows(None, None, {}, job_options)
        job_options = {
            'name': 'Job Y',
            'query_name': 'job_y_query',
        }
        job_y_id = utils.async_get_result_rows(None, None, {}, job_options)

        self.assertEqual(async_utils.get_job_count(), 3)

        jobs = async_utils.get_jobs()
        self.assertEqual(len(jobs), 3)

        job_x = async_utils.get_job(job_x_id)
        self.assertTrue(job_x in jobs)
        self.assertEqual(job_x.meta['name'], 'Job X')

        self.assertEqual(async_utils.cancel_job(job_x_id), None)
        self.assertEqual(async_utils.get_job_count(), 2)
        async_utils.cancel_job('invalid_id')
        self.assertEqual(async_utils.get_job_count(), 2)

        self.assertTrue('canceled' in async_utils.cancel_job(job_y_id))
        self.assertTrue(async_utils.get_job_count(), 1)

        async_utils.cancel_all_jobs()
        self.assertEqual(async_utils.get_job_count(), 0)
コード例 #3
0
    def test_create_and_cancel(self):
        # Create 3 meaningless jobs. We're just testing job setup and
        # cancellation here, not the execution.
        job_options = {
            'name': 'Job X',
        }
        job_x_id = utils.async_get_result_rows(None, None, {}, job_options)
        job_options = {
            'name': 'Job Y',
            'query_name': 'job_y_query',
        }
        job_y_id = utils.async_get_result_rows(None, None, {}, job_options)
        job_z_id = utils.async_get_result_rows(None, None, {})

        self.assertEqual(async_utils.get_job_count(), 3)

        jobs = async_utils.get_jobs()
        self.assertEqual(len(jobs), 3)

        job_x = async_utils.get_job(job_x_id)
        self.assertTrue(job_x in jobs)
        self.assertEqual(job_x.meta['name'], 'Job X')

        job_y = async_utils.get_job(job_y_id)
        job_z = async_utils.get_job(job_z_id)

        self.assertEqual(async_utils.cancel_job(job_x_id), None)
        # Prove job is gone from Redis
        with self.assertRaises(NoSuchJobError):
            job_x.refresh()
        # Prove job is gone from queue
        self.assertEqual(async_utils.get_job_count(), 2)
        async_utils.cancel_job('invalid_id')
        self.assertEqual(async_utils.get_job_count(), 2)

        self.assertTrue('canceled' in async_utils.cancel_job(job_y_id))
        self.assertTrue(async_utils.get_job_count(), 1)

        async_utils.cancel_all_jobs()
        with self.assertRaises(NoSuchJobError):
            job_y.refresh()
        with self.assertRaises(NoSuchJobError):
            job_z.refresh()
        self.assertEqual(async_utils.get_job_count(), 0)
コード例 #4
0
 def setUp(self):
     super(AsyncExporterResourceTestCase, self).setUp()
     utils.cancel_all_jobs()
コード例 #5
0
ファイル: preview.py プロジェクト: chop-dbhi/serrano
 def setUp(self):
     # Clear all jobs before each test case just in case any lingering jobs
     # remain.
     utils.cancel_all_jobs()
コード例 #6
0
ファイル: preview.py プロジェクト: chop-dbhi/serrano
    def setUp(self):
        # Clear all jobs before each test case just in case any lingering jobs
        # remain.
        utils.cancel_all_jobs()

        super(AsyncPreviewResourceProcessorTestCase, self).setUp()
コード例 #7
0
 def tearDown(self):
     # Don't leave any jobs in the queue.
     async_utils.cancel_all_jobs()
コード例 #8
0
 def setUp(self):
     management.call_command('avocado', 'init', 'tests', quiet=True)
     # Don't start with any jobs in the queue.
     async_utils.cancel_all_jobs()
コード例 #9
0
ファイル: utils.py プロジェクト: goldenhelix/avocado
 def tearDown(self):
     # Don't leave any jobs in the queue.
     async_utils.cancel_all_jobs()
コード例 #10
0
ファイル: utils.py プロジェクト: goldenhelix/avocado
 def setUp(self):
     management.call_command('avocado', 'init', 'tests', quiet=True)
     # Don't start with any jobs in the queue.
     async_utils.cancel_all_jobs()
コード例 #11
0
 def setUp(self):
     super(AsyncQueryResultsResourceTestCase, self).setUp()
     utils.cancel_all_jobs()
     self.query = DataQuery(user=self.user)
     self.query.save()
コード例 #12
0
ファイル: preview.py プロジェクト: cchmc-bmi-os/serrano
 def setUp(self):
     # Clear all jobs before each test case just in case any lingering jobs
     # remain.
     utils.cancel_all_jobs()
コード例 #13
0
ファイル: preview.py プロジェクト: cchmc-bmi-os/serrano
    def setUp(self):
        # Clear all jobs before each test case just in case any lingering jobs
        # remain.
        utils.cancel_all_jobs()

        super(AsyncPreviewResourceProcessorTestCase, self).setUp()
コード例 #14
0
 def setUp(self):
     # Clear all scheduled jobs before each test just in case any
     # lingering jobs remain.
     utils.cancel_all_jobs()