本文整理匯總了Python中Timer.sleep_if_not_enough方法的典型用法代碼示例。如果您正苦於以下問題:Python Timer.sleep_if_not_enough方法的具體用法?Python Timer.sleep_if_not_enough怎麽用?Python Timer.sleep_if_not_enough使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Timer
的用法示例。
在下文中一共展示了Timer.sleep_if_not_enough方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: import Timer [as 別名]
# 或者: from Timer import sleep_if_not_enough [as 別名]
def run(self, export_lim, import_lim, total_delay_time=750):
print "Estimating total entries to import...",
no_of_entries = self.es_conn.search(index=self.es_index,
doc_type='jobTitle',
body=self.es_query,
size=1)['hits']['total']
print "%d entries" % no_of_entries
print "Begin to import..."
exported = 0
start = 0
while start <= no_of_entries and (self.hard_lim_export == 0 or start <= self.hard_lim_export):
exported_entries = self.es_export_rows(start, export_lim)
exported += len(exported_entries)
start += export_lim
sys.stdout.write("\r Exported %d entries of total %d entries..." % (exported, no_of_entries))
sys.stdout.flush()
delay_timer = Timer()
self.insert_sqlite(exported_entries, import_lim)
delay_timer.sleep_if_not_enough(total_delay_time)