【问题标题】:How does one specify the input file for a runner from Python?如何为 Python 中的跑步者指定输入文件?
【发布时间】:2012-09-16 03:53:59
【问题描述】:

我正在编写一个外部脚本,以通过我笔记本电脑上的 Python mrjob 模块运行 mapreduce 作业(不在 Amazon Elastic Compute Cloud 或任何大型集群上)。

我从mrjob documentation 中得知我应该使用MRJob.make_runner() 从单独的python 脚本运行mapreduce 作业,如下所示。

mr_job = MRYourJob(args=['-r', 'emr'])
with mr_job.make_runner() as runner:
    ...

但是,如何指定要使用的输入文件?我想在与我的 mapreduce 脚本和其他运行 map reduce 的 python 脚本相同的目录中使用文件“datalines.txt”。此外,如何指定输出?

我在 mrjob 文档中找不到允许我指定这些参数的函数。

【问题讨论】:

    标签: python mapreduce mrjob


    【解决方案1】:

    Getting started guide 建议从标准输入或命令行提供的文件中读取输入:

    mr_job = MRYourJob(args=["datalines.txt"])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-04-01
      • 1970-01-01
      • 2021-09-24
      • 2015-11-16
      • 1970-01-01
      • 1970-01-01
      • 2015-02-14
      相关资源
      最近更新 更多