예제 #1
0
 def test_is_job_completed(self):
     job_id = engine._job_from_file(helpers.get_data_path(CONFIG_FILE), "db").job_id
     row = OqCalculation.objects.get(id=job_id)
     pairs = [("pending", False), ("running", False), ("succeeded", True), ("failed", True)]
     for status, is_completed in pairs:
         row.status = status
         row.save()
         self.assertEqual(CalculationProxy.is_job_completed(job_id), is_completed)
예제 #2
0
파일: job_test.py 프로젝트: angri/openquake
 def test_is_job_completed(self):
     job_id = engine._job_from_file(
         helpers.get_data_path(CONFIG_FILE), 'db').job_id
     row = models.OqJob.objects.get(id=job_id)
     pairs = [('pending', False), ('running', False),
              ('succeeded', True), ('failed', True)]
     for status, is_completed in pairs:
         row.status = status
         row.save()
         self.assertEqual(
             JobContext.is_job_completed(job_id), is_completed)
예제 #3
0
 def test_is_job_completed(self):
     job_id = engine._job_from_file(
         helpers.get_data_path(CONFIG_FILE), 'db').job_id
     row = models.OqJob.objects.get(id=job_id)
     pairs = [('pending', False), ('running', False),
              ('succeeded', True), ('failed', True)]
     for status, is_completed in pairs:
         row.status = status
         row.save()
         self.assertEqual(
             JobContext.is_job_completed(job_id), is_completed)
예제 #4
0
    def test_get_status_from_db(self):
        self.job = engine._job_from_file(helpers.get_data_path(CONFIG_FILE), "db")
        row = OqCalculation.objects.get(id=self.job.job_id)

        row.status = "failed"
        row.save()
        self.assertEqual("failed", CalculationProxy.get_status_from_db(self.job.job_id))

        row.status = "running"
        row.save()
        self.assertEqual("running", CalculationProxy.get_status_from_db(self.job.job_id))
예제 #5
0
    def test_get_status_from_db(self):
        self.job = engine._job_from_file(helpers.get_data_path(CONFIG_FILE), "db")
        row = models.OqJob.objects.get(id=self.job.job_id)

        row.status = "failed"
        row.save()
        self.assertEqual("failed", JobContext.get_status_from_db(self.job.job_id))

        row.status = "running"
        row.save()
        self.assertEqual("running", JobContext.get_status_from_db(self.job.job_id))
예제 #6
0
파일: helpers.py 프로젝트: bwyss/oq-engine
def job_from_file(config_file_path):
    """
    Create a JobContext instance from the given configuration file.

    The results are configured to go to XML files.  *No* database record will
    be stored for the job.  This allows running test on jobs without requiring
    a database.
    """

    job = engine._job_from_file(config_file_path, 'xml')
    cleanup_loggers()

    return job
예제 #7
0
def job_from_file(config_file_path):
    """
    Create a JobContext instance from the given configuration file.

    The results are configured to go to XML files.  *No* database record will
    be stored for the job.  This allows running test on jobs without requiring
    a database.
    """

    job = engine._job_from_file(config_file_path, 'xml')
    cleanup_loggers()

    return job
예제 #8
0
    def test_get_status_from_db(self):
        self.job = engine._job_from_file(
            helpers.get_data_path(CONFIG_FILE), 'db')
        row = models.OqJob.objects.get(id=self.job.job_id)

        row.status = "failed"
        row.save()
        self.assertEqual(
            "failed", JobContext.get_status_from_db(self.job.job_id))

        row.status = "running"
        row.save()
        self.assertEqual(
            "running", JobContext.get_status_from_db(self.job.job_id))
예제 #9
0
파일: job_test.py 프로젝트: angri/openquake
 def test_job_db_record_for_output_type_xml(self):
     self.job = engine._job_from_file(
         helpers.get_data_path(CONFIG_FILE), 'xml')
     models.OqJob.objects.get(id=self.job.job_id)
예제 #10
0
 def test_job_db_record_for_output_type_xml(self):
     self.job = engine._job_from_file(
         helpers.get_data_path(CONFIG_FILE), 'xml')
     models.OqJob.objects.get(id=self.job.job_id)
예제 #11
0
 def test_job_db_record_for_output_type_xml(self):
     self.job = engine._job_from_file(helpers.get_data_path(CONFIG_FILE), "xml")
     OqCalculation.objects.get(id=self.job.job_id)