Пример #1
0
 def _create_deployment_dir(self):
   """
   Return the job deployment directory in HDFS, creating it if necessary.
   The actual deployment dir should be 0711 owned by the user
   """
   path = Hdfs.join(REMOTE_DEPLOYMENT_DIR.get(), '_%s_-oozie-%s-%s' % (self.user.username, self.job.id, time.time()))
   self._create_dir(path)
   return path
Пример #2
0
def create_data_dir(fs):
  # If needed, create the remote home, deployment and data directories
  directories = (REMOTE_DEPLOYMENT_DIR.get(), REMOTE_SAMPLE_DIR.get())
  user = fs.user

  try:
    fs.setuser(fs.DEFAULT_USER)
    for directory in directories:
      if not fs.exists(directory):
        remote_home_dir = Hdfs.join('/user', fs.user)
        if directory.startswith(remote_home_dir):
          # Home is 755
          fs.create_home_dir(remote_home_dir)
        # Shared by all the users
        fs.mkdir(directory, 01777)
        fs.chmod(directory, 01777) # To remove after https://issues.apache.org/jira/browse/HDFS-3491
  finally:
    fs.setuser(user)

  return REMOTE_SAMPLE_DIR.get()