本文整理汇总了Python中azure.storage.BlobService.copy_blob方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.copy_blob方法的具体用法?Python BlobService.copy_blob怎么用?Python BlobService.copy_blob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.BlobService
的用法示例。
在下文中一共展示了BlobService.copy_blob方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set
# 需要导入模块: from azure.storage import BlobService [as 别名]
# 或者: from azure.storage.BlobService import copy_blob [as 别名]
###
bucket = 'crawl-data'
in_progress = set()
#
existing = set([x.name for x in db.list_blobs(bucket, 'common-crawl/crawl-data/CC-MAIN-2014-23/')])
todo = [x.rstrip() for x in sys.stdin.readlines()]
todo = [x for x in todo if x not in existing]
###
while todo or in_progress:
new_progress = set()
for path in in_progress:
props = db.get_blob_properties(bucket, path)
if props['x-ms-copy-status'] == 'success':
print '\t%s completed' % path
continue
new_progress.add(path)
time.sleep(0.25)
print 'Task queue length is %d' % len(new_progress)
print 'TODO queue length is %d' % len(todo)
# Populate the queue
while todo and len(new_progress) < 256:
path = todo.pop()
# If it exists, skip it -- only add if it's missing
try:
resp = db.get_blob_properties(bucket, path)
except WindowsAzureMissingResourceError:
db.copy_blob(bucket, path, 'https://aws-publicdatasets.s3.amazonaws.com/' + path)
new_progress.add(path)
in_progress = new_progress
time.sleep(300)