Permalink
Browse files

make sure cat always prints errors when path doesn't exist

  • Loading branch information...
1 parent d771944 commit 155d36dff0a77885eec3dcc1421b634fe3bf9731 @klbostee committed Jul 26, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 dumbo/backends/streaming.py
@@ -220,15 +220,15 @@ def cat(self, path, opts):
shortcuts=dict(configopts('jars')))
try:
import typedbytes
+ ls = os.popen('%s %s/bin/hadoop dfs -ls %s' % (hadenv, self.hadoop, path))
if sum(c in path for c in ("*", "?", "{")) > 0:
# cat each file separately when the path contains special chars
- ls = os.popen('%s %s/bin/hadoop dfs -ls %s' % \
- (hadenv, self.hadoop, path))
lineparts = (line.split()[-1] for line in ls)
subpaths = [part for part in lineparts if part.startswith("/")]
- ls.close()
else:
+ # we still do the ls even in this case to make sure we print errors
subpaths = [path]
+ ls.close()
for subpath in subpaths:
dumptb = os.popen('%s %s/bin/hadoop jar %s dumptb %s 2> /dev/null'
% (hadenv, self.hadoop, streamingjar, subpath))

0 comments on commit 155d36d

Please sign in to comment.