抑制命令行输出 hadoop fs 命令
suppress command line output hadoop fs command
我是 运行 hadoop mapreduce 作业,使用 Python 程序创建不同的输入路径作为 mapreduce 作业的参数。我目前正在检查 hadoop fs 路径是否存在,在我将这些输入路径传递到 mapreduce 之前,使用命令:
hadoop fs -test -e 'filename'
我的 Python 程序然后与命令行通信并确定文件是否存在(文件存在时 -test returns 0,否则为大于 1 的整数)。由于 Python 程序正在检查路径是否存在并将所有不存在的路径输出到单独的 .txt 文档,因此我不需要知道哪些路径不存在作为命令行警告。
我想知道如何抑制(或忽略)自动 hadoop fs 输出:
test: 'fileName': No such file or directory
因为我输入了大量路径,其中有相当一部分在 hadoop fs 中不存在。
将 error/warning 重定向到 /dev/null/
hdfs dfs -test -e I/dont/exist 2>/dev/null
我是 运行 hadoop mapreduce 作业,使用 Python 程序创建不同的输入路径作为 mapreduce 作业的参数。我目前正在检查 hadoop fs 路径是否存在,在我将这些输入路径传递到 mapreduce 之前,使用命令:
hadoop fs -test -e 'filename'
我的 Python 程序然后与命令行通信并确定文件是否存在(文件存在时 -test returns 0,否则为大于 1 的整数)。由于 Python 程序正在检查路径是否存在并将所有不存在的路径输出到单独的 .txt 文档,因此我不需要知道哪些路径不存在作为命令行警告。
我想知道如何抑制(或忽略)自动 hadoop fs 输出:
test: 'fileName': No such file or directory
因为我输入了大量路径,其中有相当一部分在 hadoop fs 中不存在。
将 error/warning 重定向到 /dev/null/
hdfs dfs -test -e I/dont/exist 2>/dev/null