本文整理汇总了Python中liboozie.conf.REMOTE_DEPLOYMENT_DIR.get方法的典型用法代码示例。如果您正苦于以下问题:Python REMOTE_DEPLOYMENT_DIR.get方法的具体用法?Python REMOTE_DEPLOYMENT_DIR.get怎么用?Python REMOTE_DEPLOYMENT_DIR.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liboozie.conf.REMOTE_DEPLOYMENT_DIR
的用法示例。
在下文中一共展示了REMOTE_DEPLOYMENT_DIR.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_deployment_dir
# 需要导入模块: from liboozie.conf import REMOTE_DEPLOYMENT_DIR [as 别名]
# 或者: from liboozie.conf.REMOTE_DEPLOYMENT_DIR import get [as 别名]
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
"""
# Automatic setup of the required directories if needed
create_directories(self.fs)
# Case of a shared job
if self.user != self.job.document.owner:
path = (
REMOTE_DEPLOYMENT_DIR.get()
.replace("$USER", self.user.username)
.replace("$TIME", str(time.time()))
.replace("$JOBID", str(self.job.id))
)
# Shared coords or bundles might not have any existing workspaces
if self.fs.exists(self.job.deployment_dir):
self.fs.copy_remote_dir(self.job.deployment_dir, path, owner=self.user)
else:
self._create_dir(path)
else:
path = self.job.deployment_dir
self._create_dir(path)
return path
示例2: _create_deployment_dir
# 需要导入模块: from liboozie.conf import REMOTE_DEPLOYMENT_DIR [as 别名]
# 或者: from liboozie.conf.REMOTE_DEPLOYMENT_DIR import get [as 别名]
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
"""
if self.user != self.job.owner:
path = Hdfs.join(REMOTE_DEPLOYMENT_DIR.get(), '_%s_-oozie-%s-%s' % (self.user.username, self.job.id, time.time()))
self.fs.copy_remote_dir(self.job.deployment_dir, path, owner=self.user, dir_mode=0711)
else:
path = self.job.deployment_dir
self._create_dir(path)
return path
示例3: create_directories
# 需要导入模块: from liboozie.conf import REMOTE_DEPLOYMENT_DIR [as 别名]
# 或者: from liboozie.conf.REMOTE_DEPLOYMENT_DIR import get [as 别名]
def create_directories(fs, directory_list=[]):
# If needed, create the remote home, deployment and data directories
directories = [REMOTE_DEPLOYMENT_DIR.get()] + directory_list
for directory in directories:
if not fs.do_as_user(fs.DEFAULT_USER, fs.exists, directory):
remote_home_dir = Hdfs.join('/user', fs.DEFAULT_USER)
if directory.startswith(remote_home_dir):
# Home is 755
fs.do_as_user(fs.DEFAULT_USER, fs.create_home_dir, remote_home_dir)
# Shared by all the users
fs.do_as_user(fs.DEFAULT_USER, fs.mkdir, directory, 01777)
fs.do_as_user(fs.DEFAULT_USER, fs.chmod, directory, 01777) # To remove after https://issues.apache.org/jira/browse/HDFS-3491
示例4: create_directories
# 需要导入模块: from liboozie.conf import REMOTE_DEPLOYMENT_DIR [as 别名]
# 或者: from liboozie.conf.REMOTE_DEPLOYMENT_DIR import get [as 别名]
def create_directories(fs):
# If needed, create the remote home, deployment and data directories
directories = (REMOTE_DEPLOYMENT_DIR.get(), REMOTE_SAMPLE_DIR.get())
for directory in directories:
if not fs.do_as_user("hdfs", fs.exists, directory):
remote_home_dir = Hdfs.join('/user', "hdfs")
if directory.startswith(remote_home_dir):
# Home is 755
fs.do_as_user("hdfs", fs.create_home_dir, remote_home_dir)
# Shared by all the users
fs.do_as_user("hdfs", fs.mkdir, directory, 511)
fs.do_as_user("hdfs", fs.chmod, directory, 511) # To remove after https://issues.apache.org/jira/browse/HDFS-3491
return REMOTE_SAMPLE_DIR.get()
示例5: _create_deployment_dir
# 需要导入模块: from liboozie.conf import REMOTE_DEPLOYMENT_DIR [as 别名]
# 或者: from liboozie.conf.REMOTE_DEPLOYMENT_DIR import get [as 别名]
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
"""
# Automatic setup of the required directories if needed
create_directories(self.fs)
# Case of a shared job
if self.user != self.job.owner:
path = Hdfs.join(REMOTE_DEPLOYMENT_DIR.get(), '_%s_-oozie-%s-%s' % (self.user.username, self.job.id, time.time()))
# Shared coords or bundles might not have any existing workspaces
if self.fs.exists(self.job.deployment_dir):
self.fs.copy_remote_dir(self.job.deployment_dir, path, owner=self.user, dir_mode=0711)
else:
self._create_dir(path)
else:
path = self.job.deployment_dir
self._create_dir(path)
return path