当前位置: 首页>>代码示例>>Python>>正文


Python Client.test方法代码示例

本文整理汇总了Python中snakebite.client.Client.test方法的典型用法代码示例。如果您正苦于以下问题:Python Client.test方法的具体用法?Python Client.test怎么用?Python Client.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在snakebite.client.Client的用法示例。


在下文中一共展示了Client.test方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HDFSStat

# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import test [as 别名]
class HDFSStat(object):

    cluster = 'hostname'
    port = 8020
    default_path = '/user/hive/warehouse'

    @staticmethod
    def build_path(table):
        nm = table.split('.')[0]
        tb = table.split('.')[1]
        return default_path + '/' + nm + '.db/' + tb

    def __init__(self):
        self.client = Client(HDFSStat.cluster, HDFSStat.port, use_trash=False)

    def latest_partition(self, table_name, table_path=None):
        t_path = HDFSStat.build_path(table_name) if table_path is None else table_path
        latest_dir = list(self.client.ls([t_path])).pop()
        return path.basename(latest_dir['path']).split('=')[1]

    def poke_partition(self, table_name, partition_name, partition, table_path=None):
        t_path = HDFSStat.build_path(table_name) if table_path is None else table_path
        partition_path = t_path + '/' + partition_name + '=' + partition
        return self.client.test(partition_path, exists=True, directory=True, zero_length=False)
开发者ID:imsid,项目名称:kickstarter,代码行数:26,代码来源:hdfsstat.py

示例2: is_exist

# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import test [as 别名]
def is_exist(dirPath, master = public.SPARK_MASTER, port = public.SPARK_MASTER_PORT):
    client = Client(master, port, use_trash=False)
    return client.test(dirPath, exists=True, directory=True)
开发者ID:yudongjin,项目名称:public,代码行数:5,代码来源:file_spark.py

示例3: exists

# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import test [as 别名]
 def exists(self):
     client = Client(self._host, self._port, effective_user=self._user, use_trash=False)
     return client.test(self._partial, exists=True)
开发者ID:lexman,项目名称:tuttle,代码行数:5,代码来源:hdfs.py

示例4: timedelta

# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import test [as 别名]
    swiftConf.set(key, value)

  swift_client = swift.Connection(
    user = swift_user, 
    key = swift_key, 
    authurl = swift_authurl)

# read list of files
src_files = []

if run_mode == "hdfs":
  # spotify's snakebite as hdfs client
  src_files = [ hdfs_url + files['path'] for files in hdfs_client.ls([source_files]) ]

  # deleting output directory if exists
  if (hdfs_client.test(target_dir, exists = True, directory = True)):
    hdfs_client.delete(target_dir)
    hdfs_client.rmdir(target_dir)

elif run_mode == "swift":  
  # read list of files from swift  src_files = []
  source_files = '|'.join([ '(pagecounts-' + (datetime.now() - timedelta(hours=i)).strftime("%Y%m%d-%H") + '(.*))' for i in range(48, 71) ])
  src_file_regex = re.compile(source_files)
  for data in swift_client.get_container(source_dir)[1]:
     if src_file_regex.match(data['name']):
       src_files.append(data['name'])
  
  src_files.sort(key = lambda x: os.path.basename(x))

else:
  # read list of files from local
开发者ID:RajeshThallam,项目名称:MIDS-W251-FINAL-PROJECT,代码行数:33,代码来源:wiki_latest_page_trends.py

示例5: Client

# 需要导入模块: from snakebite.client import Client [as 别名]
# 或者: from snakebite.client.Client import test [as 别名]
#!/usr/bin/env python

from snakebite.client import Client
client = Client("trevally.amer.nevint.com", 9000, use_trash=False)


def list_recursive(path):
    for x in client.ls([path]):
        if x['file_type']=='d':
            list_recursive(x['path'])
        else:
            print x['path']

target = '/data/hub/vehicle/MKZ-Grey'

if  client.test(target,directory=True):
    list_recursive(target)
开发者ID:blueskywalker,项目名称:junkyard,代码行数:19,代码来源:test-files.py


注:本文中的snakebite.client.Client.test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。