本文整理汇总了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)