本文整理匯總了Python中importer.Importer.run方法的典型用法代碼示例。如果您正苦於以下問題:Python Importer.run方法的具體用法?Python Importer.run怎麽用?Python Importer.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類importer.Importer
的用法示例。
在下文中一共展示了Importer.run方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import run [as 別名]
def run(self):
self.logger.info("NoaaImportController.run started")
print("NoaaImportController.run started")
start_after_date = self.uow.weather_stations.get_last_record_time(self.ws.id, self.year)
if start_after_date:
next_date = start_after_date + timedelta(hours=1)
if self.year < next_date.year:
self.logger.info("Skipping year " + str(self.year))
print("Skipping year " + str(self.year))
return
self.logger.debug("Downloader started")
downloader = Downloader(self.ws.usaf, self.ws.wban, self.year)
downloader.run()
self.logger.debug("Downloader ended")
self.logger.debug("Unzipper started")
unzipper = Unzipper(downloader.downloaded_file_path)
unzipper.run()
os.unlink(downloader.downloaded_file_path)
self.logger.debug("Unzipper ended")
self.logger.debug("Converter started")
converter = Converter(unzipper.unzipped_file_path)
converter.run()
os.unlink(unzipper.unzipped_file_path)
self.logger.debug("Converter ended")
self.logger.debug("Importer started")
importer = Importer(self.ws.id, self.year, start_after_date, converter.unencoded_file_path)
importer.run()
os.unlink(converter.unencoded_file_path)
self.logger.debug("Importer ended")
self.logger.info("NoaaImportController.run ended")
print("NoaaImportController.run ended")
示例2: len
# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import run [as 別名]
m.update(buf)
if len(buf) == 0:
break
fd.close()
return m.hexdigest()
except Exception, inst:
exception_info("Failed getting MD5 of %s" % path, inst)
return None
if __name__ == "__main__":
usage = """usage: %prog PATH [--host DB_HOST]"""
desc = """Import a directory into the filesystem database."""
parser = OptionParser(usage=usage, description=desc)
parser.add_option("--host", metavar="DB_HOST",
action="store", dest="db_host",
help="specify the host of the filesys database")
options, args = parser.parse_args()
if len(args) == 0:
path = ''
else:
path = args[0]
os.stat_float_times(False)
model = Model()
imp = Importer(model)
imp.run(path, options.db_host)