本文整理汇总了Python中cloud.aws.CloudHost.pull_file_from_s3方法的典型用法代码示例。如果您正苦于以下问题:Python CloudHost.pull_file_from_s3方法的具体用法?Python CloudHost.pull_file_from_s3怎么用?Python CloudHost.pull_file_from_s3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloud.aws.CloudHost
的用法示例。
在下文中一共展示了CloudHost.pull_file_from_s3方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc_stat
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import pull_file_from_s3 [as 别名]
def calc_stat(user_email):
VolMgr.STATS['num_users'] += 1
sessname = unique_sessname(user_email)
k = CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=True)
if k is not None:
VolMgr.STATS['loopback']['sizes'].append(k.size)
示例2: update_user_home_image
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import pull_file_from_s3 [as 别名]
def update_user_home_image(fetch=True):
img_dir, curr_img = os.path.split(JBoxVol.USER_HOME_IMG)
bucket, new_img = JBoxDynConfig.get_user_home_image(CloudHost.INSTALL_ID)
new_img_path = os.path.join(img_dir, new_img)
if fetch and (not os.path.exists(new_img_path)):
VolMgr.log_debug("fetching new image to %s", new_img_path)
k = CloudHost.pull_file_from_s3(bucket, new_img_path)
if k is not None:
VolMgr.log_debug("fetched new user home image")
if os.path.exists(new_img_path):
VolMgr.log_debug("set new image to %s", new_img_path)
JBoxVol.USER_HOME_IMG = new_img_path
return True
return False
示例3: pull_backup
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import pull_file_from_s3 [as 别名]
def pull_backup(user_email):
sessname = unique_sessname(user_email)
S3Disk.log_info("pulling %s.tar.gz from %s", sessname, JBoxVol.BACKUP_BUCKET)
CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=False)
示例4: pull_from_s3
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import pull_file_from_s3 [as 别名]
def pull_from_s3(local_file, metadata_only=False):
if JBoxVol.BACKUP_BUCKET is None:
return None
return CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, local_file, metadata_only=metadata_only)