浏览代码

[jobsub] Do not create sample directories as `hdfs'

* Also fix directory permission when creating the deployment directory.
* Improve logging messages on permission error
bc Wong 13 年之前
父节点
当前提交
0e78842c4b
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 1 1
      apps/jobsub/src/jobsub/management/commands/jobsub_setup.py
  2. 6 3
      apps/jobsub/src/jobsub/submit.py

+ 1 - 1
apps/jobsub/src/jobsub/management/commands/jobsub_setup.py

@@ -44,7 +44,7 @@ class Command(NoArgsCommand):
   def handle_noargs(self, **options):
     remote_fs = cluster.get_hdfs()
     if hasattr(remote_fs, "setuser"):
-      remote_fs.setuser(remote_fs.superuser)
+      remote_fs.setuser(remote_fs.DEFAULT_USER)
     LOG.info("Using remote fs: %s" % str(remote_fs))
 
     # Copy over examples/

+ 6 - 3
apps/jobsub/src/jobsub/submit.py

@@ -165,8 +165,9 @@ class Submission(object):
       return path
     except IOError, ex:
       if ex.errno != errno.ENOENT:
-        LOG.error("Error accessing workflow directory: %s" % (path,))
-        raise ex
+        msg = "Error accessing workflow directory '%s': %s" % (path, ex)
+        LOG.exception(msg)
+        raise IOError(ex.errno, msg)
       self._create_deployment_dir(path)
       return path
 
@@ -175,7 +176,9 @@ class Submission(object):
     # Make the REMOTE_DATA_DIR, and have it owned by hue
     data_repo = conf.REMOTE_DATA_DIR.get()
     if not self._fs.exists(data_repo):
-      self._do_as(self._fs.DEFAULT_USER, self._fs.mkdir, data_repo, 01777)
+      # Parent directories should be 0755. But the data dir should be 01777.
+      self._do_as(self._fs.DEFAULT_USER, self._fs.mkdir, data_repo, 0755)
+      self._do_as(self._fs.DEFAULT_USER, self._fs.chmod, data_repo, 01777)
 
     # The actual deployment dir should be 0711 owned by the user
     self._do_as(self._username, self._fs.mkdir, path, 0711)