mrjob:无效的引导动作路径,必须是Amazon S3中的位置
我在使用Windows 7系统。我安装了mrjob,当我在本地机器上运行网站上的示例 word_count 文件时,一切正常。但是,当我尝试在亚马逊EMR上运行它时却出现了错误。我甚至用boto测试了连接亚马逊S3,结果是可以的。
mrjob.conf 文件
runners:
emr:
aws_access_key_id: xxxxxxxxxxxxx
aws_region: us-east-1
aws_secret_access_key: xxxxxxxx
ec2_key_pair: bzy
ec2_key_pair_file: C:\aa.pem
ec2_instance_type: m1.small
num_ec2_instances: 3
s3_log_uri: s3://myunique/
s3_scratch_uri: s3://myunique/
我在命令行中运行以下内容
python word_count.py -c mrjob.conf -r emr mytext.txt
结果是
有人建议这可能是Windows路径相关的问题,所以我仔细检查了源代码中的parse.py,发现它似乎有处理Windows文件类型的相关检查。
# Used to check if the candidate candidate uri is actually a local windows path.
WINPATH_RE = re.compile(r"^[aA-zZ]:\\")
def is_windows_path(uri):
"""Return True if *uri* is a windows path."""
if WINPATH_RE.match(uri):
return True
else:
return False
def is_uri(uri):
"""Return True if *uri* is any sort of URI."""
if is_windows_path(uri):
return False
return bool(urlparse(uri).scheme)
我不明白的是,即使在更新了代码之后,我仍然遇到这个错误,我不知道接下来该怎么做。
2 个回答
1
我之前也遇到过类似的问题,后来发现我的问题是我在工作中包含了来自不同文件的代码,而这些文件的路径也被写进去了。如果是这种情况,就会出现提到的错误。
3
你遇到的问题是因为Windows的文件系统在路径中使用了转义字符\(反斜杠)。只需要把它写两次,就不会再有问题了。
把你的mrjob.conf文件改成:
runners:
emr:
aws_access_key_id: xxxxxxxxxxxxx
aws_region: us-east-1
aws_secret_access_key: xxxxxxxx
ec2_key_pair: bzy
ec2_key_pair_file: C:\\aa.pem
ec2_instance_type: m1.small
num_ec2_instances: 3
s3_log_uri: s3://myunique/
s3_scratch_uri: s3://myunique/
想了解更多信息,可以访问:http://yaml.org/spec/1.2/spec.html#id2770814