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


Python MRJob.mr_job_script方法代码示例

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


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

示例1: test_should_exit_when_invoked_as_script

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
 def test_should_exit_when_invoked_as_script(self):
     args = [sys.executable, MRJob.mr_job_script(), '--quux', 'baz']
     # add . to PYTHONPATH (in case mrjob isn't actually installed)
     env = combine_envs(os.environ, {'PYTHONPATH': os.path.abspath('.')})
     proc = Popen(args, stderr=PIPE, stdout=PIPE, env=env)
     proc.communicate()
     self.assertEqual(proc.returncode, 2)
开发者ID:bchess,项目名称:mrjob,代码行数:9,代码来源:test_job.py

示例2: test_libjars_attr_relative_path

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
    def test_libjars_attr_relative_path(self):
        job_dir = os.path.dirname(MRJob.mr_job_script())

        with patch.object(MRJob, 'LIBJARS', ['cookie.jar', '/left/dora.jar']):
            job = MRJob()

            self.assertEqual(
                job._runner_kwargs()['libjars'],
                [os.path.join(job_dir, 'cookie.jar'), '/left/dora.jar'])
开发者ID:okomestudio,项目名称:mrjob,代码行数:11,代码来源:test_job.py

示例3: test_libjars_attr_relative_path

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
    def test_libjars_attr_relative_path(self):
        job_dir = os.path.dirname(MRJob.mr_job_script())

        with patch.object(MRJob, "LIBJARS", ["cookie.jar", "/left/dora.jar"]):
            job = MRJob()

            self.assertEqual(
                job.job_runner_kwargs()["libjars"], [os.path.join(job_dir, "cookie.jar"), "/left/dora.jar"]
            )
开发者ID:davidmarin,项目名称:mrjob,代码行数:11,代码来源:test_job.py

示例4: test_libjars_environment_variables

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
    def test_libjars_environment_variables(self):
        job_dir = os.path.dirname(MRJob.mr_job_script())

        with patch.dict("os.environ", A="/path/to/a", B="b"):
            with patch.object(MRJob, "LIBJARS", ["$A/cookie.jar", "$B/honey.jar"]):
                job = MRJob()

                # libjars() peeks into envvars to figure out if the path
                # is relative or absolute
                self.assertEqual(
                    job.job_runner_kwargs()["libjars"], ["$A/cookie.jar", os.path.join(job_dir, "$B/honey.jar")]
                )
开发者ID:davidmarin,项目名称:mrjob,代码行数:14,代码来源:test_job.py

示例5: test_libjars_environment_variables

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
    def test_libjars_environment_variables(self):
        job_dir = os.path.dirname(MRJob.mr_job_script())

        with patch.dict('os.environ', A='/path/to/a', B='b'):
            with patch.object(MRJob, 'LIBJARS',
                              ['$A/cookie.jar', '$B/honey.jar']):
                job = MRJob()

                # libjars() peeks into envvars to figure out if the path
                # is relative or absolute
                self.assertEqual(
                    job._runner_kwargs()['libjars'],
                    ['$A/cookie.jar', os.path.join(job_dir, '$B/honey.jar')])
开发者ID:okomestudio,项目名称:mrjob,代码行数:15,代码来源:test_job.py

示例6: test_should_exit_when_invoked_as_script

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import mr_job_script [as 别名]
 def test_should_exit_when_invoked_as_script(self):
     args = ['python', MRJob.mr_job_script(), '--quux', 'baz']
     proc = Popen(args, stderr=PIPE, stdout=PIPE)
     stderr, stdout = proc.communicate()
     assert_equal(proc.returncode, 2)
开发者ID:atiw003,项目名称:mrjob,代码行数:7,代码来源:job_test.py


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