Exemplo n.º 1
0
    def update_job_state(slice_job, state):
        """Updates the slice_job state through a POST to the server.

        Rev 1. Since we are all on one server this does not need to post. It
        will simply update the slice_job state and then save it.
        """
        if not slice_job or not state:
            return False

        slice_job.state = state
        return models.update_job(slice_job)
Exemplo n.º 2
0
    def update_job_state(slice_job, state):
        """Updates the slice_job state through a POST to the server.

        Rev 1. Since we are all on one server this does not need to post. It
        will simply update the slice_job state and then save it.
        """
        if not slice_job or not state:
            return False

        slice_job.state = state
        return models.update_job(slice_job)
Exemplo n.º 3
0
    def test_models_update_job(self):
        """ Tests if we can update properties and persist them.
        """
        test_job = self.gen_test_job()

        self.assertIsNotNone(test_job)

        # Change the config filename
        config = 'new_config.ini'
        test_job.config = config

        # Update the job
        result = models.update_job(test_job)
        self.assertTrue(result)

        # Retrieve the job to ensure that we have what is in the DB
        result = models.get_job_by_id(test_job.job_id)
        self.assertIsNotNone(result)
        self.assertEqual(result.config, unicode(config))

        # Cleanup - remove the item from the db
        result = models.remove_job(result)
        logging.info('remove_result: %s' % str(result))
        self.assertTrue(result)
Exemplo n.º 4
0
    def test_models_update_job(self):
        """ Tests if we can update properties and persist them.
        """
        test_job = self.gen_test_job()

        self.assertIsNotNone(test_job)

        # Change the config filename
        config = 'new_config.ini'
        test_job.config = config

        # Update the job
        result = models.update_job(test_job)
        self.assertTrue(result)

        # Retrieve the job to ensure that we have what is in the DB
        result = models.get_job_by_id(test_job.job_id)
        self.assertIsNotNone(result)
        self.assertEqual(result.config, unicode(config))

        # Cleanup - remove the item from the db
        result = models.remove_job(result)
        logging.info('remove_result: %s' % str(result))
        self.assertTrue(result)