本文整理汇总了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)
示例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'])
示例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"]
)
示例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")]
)
示例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')])
示例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)