コード例 #1
0
ファイル: test_driver.py プロジェクト: csarradet/jgoogler
    def test_unstick(self):
        # Simulate a broken batch job with a database footprint
        create_stuck_batch_job()
        self.assertTrue(BatchJob.get())
        self.assertTrue(Student.get_all_id_numbers())
        
        # Queue and fire the unstick task
        driver.queue_unstick()
        tasks = self.taskqueue_stub.get_filtered_tasks()
        self.assertEqual(len(tasks), 1)
        result = deferred.run(tasks[0].payload)

        # Ensure relevant DB tables have been cleared
        self.assertFalse(BatchJob.get())
        self.assertFalse(Student.get_all_id_numbers())
コード例 #2
0
ファイル: utilities.py プロジェクト: csarradet/jgoogler
    def post_auth_success(self):
        action_taken = "Unrecognized command"
        command = self.request.get("command")

        if command == "Run anonymizer now":
            try:
                log.info("Queuing anonymizer task (interactive request)")
                driver.queue()
                action_taken = "Manual anonymizer run scheduled, see server log for details"
            except Exception as e: #pylint: disable=broad-except,invalid-name
                action_taken = e

        if command == "Clear stuck batch job":
            try:
                log.info("Queuing clear batch task (interactive request)")
                driver.queue_unstick()
                action_taken = "Clearing stuck batch job, see server log for details"
            except Exception as e: #pylint: disable=broad-except,invalid-name
                action_taken = e


        self.render("utilities.html", action_taken=action_taken)