当前位置: 首页>>代码示例>>Python>>正文


Python Job.from_file方法代码示例

本文整理汇总了Python中openquake.job.Job.from_file方法的典型用法代码示例。如果您正苦于以下问题:Python Job.from_file方法的具体用法?Python Job.from_file怎么用?Python Job.from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openquake.job.Job的用法示例。


在下文中一共展示了Job.from_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def setUp(self):
        self.generated_files = []
        self.job = Job.from_file(test.do_test_file(CONFIG_FILE))
        self.job_with_includes = Job.from_file(test.do_test_file(CONFIG_WITH_INCLUDES))

        self.generated_files.append(self.job.super_config_path)
        self.generated_files.append(self.job_with_includes.super_config_path)
开发者ID:ChristopherMacGown,项目名称:openquake,代码行数:9,代码来源:job_unittest.py

示例2: setUp

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def setUp(self):
        self.generated_files = []
        self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE))
        self.job_with_includes = \
            Job.from_file(helpers.get_data_path(CONFIG_WITH_INCLUDES))

        self.generated_files.append(self.job.super_config_path)
        self.generated_files.append(self.job_with_includes.super_config_path)
开发者ID:hsberlin,项目名称:openquake,代码行数:10,代码来源:job_unittest.py

示例3: test_prepares_blocks_using_the_input_region

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def test_prepares_blocks_using_the_input_region(self):
        """ This test might be currently catastrophically retarded. If it is
        blame Lars.
        """

        block_path = helpers.get_data_path(BLOCK_SPLIT_TEST_FILE)

        print "In open job"
        a_job = Job.from_file(block_path)
        self.generated_files.append(a_job.super_config_path)

        verts = [float(x) for x in a_job.params['REGION_VERTEX'].split(",")]
        # Flips lon and lat, and builds a list of coord tuples
        coords = zip(verts[1::2], verts[::2])
        expected = shapes.RegionConstraint.from_coordinates(coords)
        expected.cell_size = float(a_job.params['REGION_GRID_SPACING'])

        expected_sites = []
        for site in expected:
            print site
            expected_sites.append(site)

        a_job._partition()
        blocks_keys = a_job.blocks_keys
        print blocks_keys

        self.assertEqual(1, len(blocks_keys))
        self.assertEqual(job.Block(expected_sites),
                         job.Block.from_kvs(blocks_keys[0]))
开发者ID:danciul,项目名称:openquake,代码行数:31,代码来源:job_unittest.py

示例4: test_is_job_completed

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_is_job_completed(self):
     job_id = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db').job_id
     session = get_db_session("reslt", "writer")
     pairs = [('pending', False), ('running', False),
              ('succeeded', True), ('failed', True)]
     for status, is_completed in pairs:
         session.query(OqJob).update({'status': status})
         session.commit()
         self.assertEqual(Job.is_job_completed(job_id), is_completed)
开发者ID:johndouglas,项目名称:openquake,代码行数:11,代码来源:job_unittest.py

示例5: test_is_job_completed

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_is_job_completed(self):
     job_id = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db').job_id
     row = 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(Job.is_job_completed(job_id), is_completed)
开发者ID:favalex,项目名称:openquake,代码行数:11,代码来源:job_unittest.py

示例6: test_get_status_from_db

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def test_get_status_from_db(self):
        self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db')

        session = get_db_session("reslt", "writer")
        session.query(OqJob).update({'status': 'failed'})
        session.commit()
        self.assertEqual(Job.get_status_from_db(self.job.job_id), 'failed')
        session.query(OqJob).update({'status': 'running'})
        session.commit()
        self.assertEqual(Job.get_status_from_db(self.job.job_id), 'running')
开发者ID:johndouglas,项目名称:openquake,代码行数:12,代码来源:job_unittest.py

示例7: test_set_status

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def test_set_status(self):
        self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db')

        session = get_db_session("reslt", "writer")

        status = 'running'
        self.job.set_status(status)

        job = session.query(OqJob).filter(OqJob.id == self.job.job_id).one()

        self.assertEqual(status, job.status)
开发者ID:johndouglas,项目名称:openquake,代码行数:13,代码来源:job_unittest.py

示例8: test_get_status_from_db

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def test_get_status_from_db(self):
        self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db')
        row = OqJob.objects.get(id=self.job.job_id)

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

        row.status = "running"
        row.save()
        self.assertEqual("running", Job.get_status_from_db(self.job.job_id))
开发者ID:favalex,项目名称:openquake,代码行数:13,代码来源:job_unittest.py

示例9: job_from_file

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
def job_from_file(config_file_path):
    """
    Create a Job 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 = Job.from_file(config_file_path, 'xml')
    cleanup_loggers()

    return job
开发者ID:johndouglas,项目名称:openquake,代码行数:15,代码来源:helpers.py

示例10: test_job_with_only_hazard_config_only_has_hazard_section

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_job_with_only_hazard_config_only_has_hazard_section(self):
     FLAGS.include_defaults = False
     job_with_only_hazard = Job.from_file(helpers.get_data_path(HAZARD_ONLY))
     self.assertEqual(["HAZARD"], job_with_only_hazard.sections)
     FLAGS.include_defaults = True
开发者ID:danciul,项目名称:openquake,代码行数:7,代码来源:job_unittest.py

示例11: test_can_store_and_read_jobs_from_kvs

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_can_store_and_read_jobs_from_kvs(self):
     self.job = Job.from_file(os.path.join(helpers.DATA_DIR, CONFIG_FILE))
     self.generated_files.append(self.job.super_config_path)
     self.assertEqual(self.job, Job.from_kvs(self.job.id))
开发者ID:danciul,项目名称:openquake,代码行数:6,代码来源:job_unittest.py

示例12: test_job_runs_with_a_good_config

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_job_runs_with_a_good_config(self):
     job = Job.from_file(TEST_JOB_FILE)
     self.assertTrue(job.launch())
开发者ID:danciul,项目名称:openquake,代码行数:5,代码来源:job_unittest.py

示例13: test_classical_psha_based_job

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_classical_psha_based_job(self):
     job = Job.from_file(TEST_JOB_FILE_CLASSICAL)
     self.assertTrue(job.launch())
开发者ID:danciul,项目名称:openquake,代码行数:5,代码来源:job_unittest.py

示例14: test_job_db_record_for_output_type_xml

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
    def test_job_db_record_for_output_type_xml(self):
        self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'xml')

        session = get_db_session("uiapi", "writer")

        session.query(OqJob).filter(OqJob.id == self.job.job_id).one()
开发者ID:johndouglas,项目名称:openquake,代码行数:8,代码来源:job_unittest.py

示例15: test_set_status

# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import from_file [as 别名]
 def test_set_status(self):
     self.job = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db')
     status = 'running'
     self.job.set_status(status)
     self.assertEqual(status, OqJob.objects.get(id=self.job.job_id).status)
开发者ID:favalex,项目名称:openquake,代码行数:7,代码来源:job_unittest.py


注:本文中的openquake.job.Job.from_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。