本文整理汇总了Python中misc.Logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.warn方法的具体用法?Python Logger.warn怎么用?Python Logger.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc.Logger
的用法示例。
在下文中一共展示了Logger.warn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Master
# 需要导入模块: from misc import Logger [as 别名]
# 或者: from misc.Logger import warn [as 别名]
#.........这里部分代码省略.........
live_activity_group_ids = self._translate_live_activity_groups_names_to_ids(constructor_args['live_activity_groups'])
unpacked_arguments = {}
unpacked_arguments['space.name'] = constructor_args['space_name']
unpacked_arguments['space.description'] = constructor_args['space_description']
unpacked_arguments['_eventId_save'] = 'Save'
unpacked_arguments['liveActivityGroupIds'] = live_activity_group_ids
if not self._api_object_exists(Space, constructor_args, self.get_space):
space = Space().new(self.uri, unpacked_arguments)
self.log.info("Master:new_space:%s" % space)
return space
else:
return []
def new_named_script(self, name, description, language, content, scheduled=None):
"""Creates a new named script."""
raise NotImplementedError
""" Private methods below """
def _translate_live_activity_groups_names_to_ids(self, live_activity_groups):
"""
Converts live activity groups dicts to list of ids
:param live_activities: list of dictionaries containing following keys::
{\
"live_activity_group_name" : "some_name",\
}
:rtype: list
"""
live_activity_groups_ids = []
for lag_data in live_activity_groups:
live_activity_group = self.get_live_activity_group(lag_data)
live_activity_groups_ids.append(live_activity_group.id())
self.log.info("Translated %s live_activity_groups_names to ids with a result of %s" % (len(live_activity_groups_ids), live_activity_groups_ids) )
return live_activity_groups_ids
def _translate_live_activities_names_to_ids(self, live_activities):
"""
Converts live activities dicts to list of ids
:param live_activities: list of dictionaries containing following keys::
{\
"live_activity_name" : "some_name",\
"space_controller_name" : "some controller name"\
}
:rtype: list
"""
live_activity_ids = []
for la_data in live_activities:
self.log.info("Getting Live Activity for data: %s" % la_data)
live_activity = self.get_live_activity(la_data)
live_activity_ids.append(live_activity.id())
self.log.info("Translated %s live_activity_names to ids with a result of %s" % (len(live_activity_ids), live_activity_ids) )
return live_activity_ids
""" Private methods below """
def _api_object_exists(self, object_type, constructor_args, getter_method):
self.log.info("Checking whether object %s with following attributes %s exists in the API" % (object_type, constructor_args))
api_object = getter_method(constructor_args)
if api_object:
self.log.warn("Object already exists: %s" % api_object)
return True
else:
self.log.info("Object does not exist yet")
return False
def _validate_single_getter_results(self, response, expected_type, exception):
"""
Validates response from the API. Runs type and other simple checks.
:param response: list of objects returned from api
:param expected_type: expected type of the object
:param exception: exception to throw if response is invalid
:rtype: interactivespaces object
"""
if len(response) > 1:
raise exception("API query returned more than one row")
elif len(response) == 0:
return None
elif isinstance(response[0], expected_type):
try:
api_object = response[0].fetch()
self.log.info("Getter method returned Object:%s" % str(api_object))
return api_object
except Exception, e:
raise
else: