本文整理汇总了Python中status.Status.final_status方法的典型用法代码示例。如果您正苦于以下问题:Python Status.final_status方法的具体用法?Python Status.final_status怎么用?Python Status.final_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类status.Status
的用法示例。
在下文中一共展示了Status.final_status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BitcasaDownload
# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import final_status [as 别名]
#.........这里部分代码省略.........
step2_args = ( self.status, self.should_exit, self.results, self.args )
download_args = ( self.status, self.should_exit, self.session, self.results, self.args)
folder_args = ( self.status, self.results, self.args, self.should_exit )
self.status.queue(folder)
if not self.args.dryrun and not self.args.local:
log.debug("Starting Downloaders")
for qid in xrange(self.args.threads):
qid += 1
download_thread = threading.Thread(target=DownloadThread, args=download_args, name="Download %s" % qid)
download_thread.daemon = True
download_thread.start()
self.download_threads.append(download_thread)
log.debug("Starting Queuers")
for qid in xrange(self.args.folderthreads):
qid += 1
folder_thread = threading.Thread(target=FolderThread, args=folder_args, name="Queuer %s" % qid)
folder_thread.daemon = True
folder_thread.start()
self.folder_threads.append(folder_thread)
if not self.args.dryrun and self.args.upload:
log.debug("Starting Uploaders")
for qid in xrange(self.args.threads):
qid += 1
upload_thread = threading.Thread(target=UploadThread, args=step2_args, name="Upload %s" % qid)
upload_thread.daemon = True
upload_thread.start()
self.upload_threads.append(upload_thread)
elif not self.args.dryrun and self.args.temp:
log.debug("Starting Movers")
for qid in xrange(self.args.threads):
qid += 1
copy_thread = threading.Thread(target=CopyThread, args=step2_args, name="Move %s" % qid)
copy_thread.daemon = True
copy_thread.start()
self.copy_threads.append(copy_thread)
if self.args.progress:
self.status_thread = threading.Thread(target=self.status.StatusThread, args=(self.args.upload, self.args.temp, self.should_exit), name="Progress")
self.status_thread.daemon = True
self.status_thread.start()
self.end_process()
def process_single(self):
log.debug("Getting file info")
myfile = None
if self.args.upload and self.args.local:
size = 0
name = ""
try:
if os.path.isdir(self.basefolder):
raise OSError("Incorrect file")
size = os.path.getsize(self.basefolder)
name = os.path.basename(self.basefolder)
except OSError:
log.exception("Error getting file")
return
myfile = BitcasaFile(None, self.basefolder, name, None, size)
fold = BitcasaFolder(None, "root", "", items=[myfile])
else:
remainingtries = 3
apiratecount = 1
while myfile is None and remainingtries > 0 and not self.should_exit.is_set():
try:
myfile = self.client.get_file_meta(self.basefolder)
except BitcasaException as e:
remainingtries -= 1
if e.code == 9006:
apiratecount += 1
remainingtries += 1
log.warn("API rate limit reached. Will retry")
else:
log.warn("Couldn't get file %s. Will retry %s more times", e.code, remainingtries)
if remainingtries > 0:
time.sleep(10 * apiratecount)
else:
log.error("Error could not retrieve file")
return
fold = BitcasaFolder(self.client, "root", "", items=[myfile])
log.debug("Got file info")
self.process(fold)
def end_process(self):
# Give the queuers time to catch up
try:
if not self.should_exit.is_set():
time.sleep(10)
except (KeyboardInterrupt, IOError):
pass
self.status.join_queues()
log.debug("Finished waiting")
#Log final speed and statistics
if not self.args.dryrun:
self.status.final_status(self.args.upload, self.args.temp, final=True)