本文整理汇总了Python中mrjob.hadoop.fully_qualify_hdfs_path函数的典型用法代码示例。如果您正苦于以下问题:Python fully_qualify_hdfs_path函数的具体用法?Python fully_qualify_hdfs_path怎么用?Python fully_qualify_hdfs_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fully_qualify_hdfs_path函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _pick_spark_tmp_dir
def _pick_spark_tmp_dir(self):
if self._opts['spark_tmp_dir']:
return self.fs.join(self._opts['spark_tmp_dir'], self._job_key)
else:
master = self._spark_master() or 'local'
if master.startswith('local'): # including local-cluster
# need a local temp dir
# add "-spark" so we don't collide with default local temp dir
return os.path.join(
gettempdir(), self._job_key + '-spark')
else:
# use HDFS (same default as HadoopJobRunner)
return posixpath.join(
fully_qualify_hdfs_path('tmp/mrjob'), self._job_key)
示例2: test_other_uri
def test_other_uri(self):
self.assertEqual(fully_qualify_hdfs_path('foo://bar/baz'),
'foo://bar/baz')
示例3: test_s3n_uri
def test_s3n_uri(self):
self.assertEqual(fully_qualify_hdfs_path('s3n://bucket/oh/noes'),
's3n://bucket/oh/noes')
示例4: test_hdfs_uri
def test_hdfs_uri(self):
self.assertEqual(fully_qualify_hdfs_path('hdfs://host/path/'),
'hdfs://host/path/')
示例5: test_absolute_path
def test_absolute_path(self):
self.assertEqual(fully_qualify_hdfs_path('/path/to/cheese'),
'hdfs:///path/to/cheese')
示例6: test_relative_path
def test_relative_path(self):
with patch('getpass.getuser') as getuser:
getuser.return_value = 'dave'
self.assertEqual(fully_qualify_hdfs_path('path/to/chocolate'),
'hdfs:///user/dave/path/to/chocolate')
示例7: test_empty
def test_empty(self):
with patch('getpass.getuser') as getuser:
getuser.return_value = 'dave'
self.assertEqual(fully_qualify_hdfs_path(''), 'hdfs:///user/dave/')
示例8: test_relative_path
def test_relative_path(self):
with patch("getpass.getuser") as getuser:
getuser.return_value = "dave"
self.assertEqual(fully_qualify_hdfs_path("path/to/chocolate"), "hdfs:///user/dave/path/to/chocolate")
示例9: test_empty
def test_empty(self):
with patch("getpass.getuser") as getuser:
getuser.return_value = "dave"
self.assertEqual(fully_qualify_hdfs_path(""), "hdfs:///user/dave/")