本文整理匯總了Python中virtualisation.misc.log.Log.w方法的典型用法代碼示例。如果您正苦於以下問題:Python Log.w方法的具體用法?Python Log.w怎麽用?Python Log.w使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類virtualisation.misc.log.Log
的用法示例。
在下文中一共展示了Log.w方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: deploy
# 需要導入模塊: from virtualisation.misc.log import Log [as 別名]
# 或者: from virtualisation.misc.log.Log import w [as 別名]
def deploy(self, f, autostart=False):
"""
:param f:
:param autostart:
:return: a tuple with 3 elements. 1. status as string, 2. error message as string, 3. list of uuids of added wrapper
"""
L.i("Deploying", f)
sensordescriptions = []
try:
zFile = zipfile.ZipFile(f)
if "deploy.json" in zFile.namelist():
deployDescription = JOb(zFile.open("deploy.json", "r"))
sys.path.insert(0, f)
if deployDescription.isList():
for dd in deployDescription:
module = __import__(dd.module)
wrapper = getattr(module, dd["class"])()
self.addWrapper(wrapper)
sensordescriptions.append(wrapper.getSensorDescription())
if autostart:
self.startWrapper(wrapper)
else:
module = __import__(deployDescription.module)
wrapper = getattr(module, deployDescription["class"])()
self.addWrapper(wrapper)
sensordescriptions.append(wrapper.getSensorDescription())
if autostart:
self.startWrapper(wrapper)
return "OK", "", sensordescriptions
except Exception as e:
L.w("Deployment of wrapper", f, "failed.", e.message)
return "Fail", e.message, []
示例2: setTimeframe
# 需要導入模塊: from virtualisation.misc.log import Log [as 別名]
# 或者: from virtualisation.misc.log.Log import w [as 別名]
def setTimeframe(self, startdate, enddate):
if not isinstance(self.data, list):
Log.i("Searching start date in historic data for", self.wrapper.getSensorDescription().sensorID, "...")
if self.data.scrollTo(startdate):
Log.i("done")
else:
Log.w("no historic data beginning at", startdate, "found")
super(CSVHistoryReader, self).setTimeframe(startdate, enddate)
示例3: start_messagebus
# 需要導入模塊: from virtualisation.misc.log import Log [as 別名]
# 或者: from virtualisation.misc.log.Log import w [as 別名]
def start_messagebus(self, args):
L.i("Connecting to the message bus")
self.messageBusQueue = QueueThread(handler=self.sendMessageHandler)
try:
# prepare RabbitMQ configuration
rmq_host = str(self.config.rabbitmq.host)
rmq_port = self.config.rabbitmq.port
rmq_username = self.config.rabbitmq.username if "username" in self.config.rabbitmq else None
rmq_password = self.config.rabbitmq.username if "password" in self.config.rabbitmq else None
if rmq_username:
if rmq_password:
RabbitMQ.establishConnection(rmq_host, rmq_port, rmq_username, rmq_password)
else:
RabbitMQ.establishConnection(rmq_host, rmq_port, rmq_username)
else:
RabbitMQ.establishConnection(rmq_host, rmq_port)
L.i("Connected to the message bus")
self.messageBusQueue.start()
except MessageBusConnectionError:
self.args.messagebus = False
args.messagebus = False
L.w("Could not connect to MessageBus server. Disabling MessageBus feature.")
示例4: startReplay
# 需要導入模塊: from virtualisation.misc.log import Log [as 別名]
# 或者: from virtualisation.misc.log.Log import w [as 別名]
def startReplay(self):
# cherrypy.tree.mount(dowser.Root(), '/dowser')
self._startQueues()
method = self.replayEnd
args = None
start_time = datetime.datetime.now()
# if continuelive enabled set "start" as method to set the system to live mode if historic replay is finished
if ResourceManagement.args.continuelive:
method = self.start
args = True
if ResourceManagement.args.speed:
self.clock = ReplayClock(ResourceManagement.args.speed, endCallback=method, endCallbackArgs=args)
else:
self.clock = ReplayClock(endCallback=method)
if ResourceManagement.args.end and ResourceManagement.args.start:
try:
startDate = datetime.datetime.strptime(ResourceManagement.args.start, ReplayClock.parserformat)
endDate = datetime.datetime.strptime(ResourceManagement.args.end, ReplayClock.parserformat)
# for w in self.wrappers:
# w.setTimeframe(startDate, endDate)
if startDate > endDate:
L.w("start date after end date. Changing both")
tmp = endDate
endDate = startDate
startDate = tmp
self.clock.setTimeframe(startDate, endDate)
except Exception as e:
L.e("Problem parsing start- or end date:", str(e))
raise e
else:
raise Exception("start- and enddate required for replay mode")
if ResourceManagement.args.pt:
from virtualisation.resourcemanagement.performancetestreceiver import PerformanceMeterMinutes
performancetest = PerformanceMeterMinutes() # PerformanceMeterSeconds()
for w in self.wrappers:
w.setReplayMode(True)
w.setClock(self.clock)
w.setTimeframe(startDate, endDate)
w.addReceiver(self)
if ResourceManagement.args.pt:
w.addReceiver(performancetest)
w.start()
w.runReplay()
if not self.args.noQuality:
if not self.averageStreamQuality:
self.averageStreamQuality = AverageStreamQuality(self, self.clock)
else:
self.averageStreamQuality.setClock(self.clock)
self.clock.runAsync()
self.startMonitor()
if not ResourceManagement.args.continuelive:
raw_input("press Enter to end.\n")
self.clock.stop()
L.i("Runtime", datetime.datetime.now() - start_time)