Example #1
0
 def test_finished(self):
     job = Job("No ID",
               self.test_jobs_module.constants.THROW_AN_EXCEPTION_JOB_NAME,
               {"No": "Config"}, "some_complex_key")
     job.start()
     while job.running():
         pass
     self.assertTrue(job.finished())
Example #2
0
 def test_kill(self):
     job = Job("No ID",
               self.test_jobs_module.constants.WAIT_10_SECONDS_JOB_NAME,
               {"No": "Config"}, "temp_api_key")
     logger.info("Starting job")
     job.start()
     self.assertTrue(job.running())
     job.kill()
     start_time = time.time()
     while job.running():
         if time.time() - start_time > 1:
             raise Exception("Job not killed in time")
     self.assertTrue(job.finished())
Example #3
0
 def test_returns_exception_information_in_status(self):
     config = {}
     job = Job("666",
               self.test_jobs_module.constants.THROW_AN_EXCEPTION_JOB_NAME,
               config,
               "api_key",
               entry_point_group_name='hoplite.test_jobs')
     job.start()
     while job.running():
         time.sleep(.01)
     exc_info = job.status()["exception"]
     traceback = None
     # Get to the bottom level of the exception information
     while ('type' not in exc_info) and (exc_info is not None):
         traceback = exc_info.get("traceback", None)
         exc_info = exc_info.get('previous_exception', None)
     self.maxDiff = None
     self.assertEqual(exc_info["type"], str(TypeError))
     self.assertEqual(exc_info["message"], "THE SKY IS FALLING!!")
     self.assertIsNotNone(traceback)
Example #4
0
 def setUp(self):
     super(TestJob, self).setUp()
     self.job = Job("{3939}", DOWNLOAD_NETWORK_FOLDER_JOB_NAME,
                    {"path": "/path/to/something"}, "temp")