本文整理汇总了Python中mrjob.hadoop.HadoopJobRunner.du方法的典型用法代码示例。如果您正苦于以下问题:Python HadoopJobRunner.du方法的具体用法?Python HadoopJobRunner.du怎么用?Python HadoopJobRunner.du使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mrjob.hadoop.HadoopJobRunner
的用法示例。
在下文中一共展示了HadoopJobRunner.du方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_du
# 需要导入模块: from mrjob.hadoop import HadoopJobRunner [as 别名]
# 或者: from mrjob.hadoop.HadoopJobRunner import du [as 别名]
def test_du(self):
root = os.environ['MOCK_HDFS_ROOT']
data_path_1 = os.path.join(root, 'data1')
with open(data_path_1, 'w') as f:
f.write("abcd")
remote_data_1 = 'hdfs:///data1'
data_dir = os.path.join(root, 'more')
os.mkdir(data_dir)
remote_dir = 'hdfs:///more'
data_path_2 = os.path.join(data_dir, 'data2')
with open(data_path_2, 'w') as f:
f.write("defg")
remote_data_2 = 'hdfs:///more/data2'
data_path_3 = os.path.join(data_dir, 'data3')
with open(data_path_3, 'w') as f:
f.write("hijk")
remote_data_2 = 'hdfs:///more/data3'
runner = HadoopJobRunner(conf_path=False)
self.assertEqual(runner.du(root), 12)
self.assertEqual(runner.du(remote_dir), 8)
self.assertEqual(runner.du(remote_dir + '/*'), 8)
self.assertEqual(runner.du(remote_data_1), 4)
self.assertEqual(runner.du(remote_data_2), 4)