コード例 #1
0
ファイル: job_unittest.py プロジェクト: kpanic/openquake
 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
ファイル: job_unittest.py プロジェクト: kpanic/openquake
    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
ファイル: job_unittest.py プロジェクト: wmorales/oq-engine
    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
ファイル: helpers.py プロジェクト: wmorales/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
コード例 #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
ファイル: job_unittest.py プロジェクト: kpanic/openquake
 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)