本文整理汇总了Python中common.LOGGER.warning方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.warning方法的具体用法?Python LOGGER.warning怎么用?Python LOGGER.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.LOGGER
的用法示例。
在下文中一共展示了LOGGER.warning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_servers
# 需要导入模块: from common import LOGGER [as 别名]
# 或者: from common.LOGGER import warning [as 别名]
def start_servers(
processes,
ami_id,
user_data,
setup_disks,
instance_type,
obs_ids,
created_by,
name,
instance_details,
spot_price,
frequency_channels,
force):
cvel_data = get_cvel()
# Create the queue
tasks = multiprocessing.JoinableQueue()
# Start the consumers
for x in range(processes):
consumer = Consumer(tasks)
consumer.start()
counter = 1
for obs_id in obs_ids:
snapshot_id = OBS_IDS.get(obs_id)
if snapshot_id is None:
LOGGER.warning('The obs-id: {0} does not exist in the settings file')
else:
obs_id_dashes = obs_id.replace('_', '-')
for frequency_groups in get_frequency_groups(frequency_channels, obs_id_dashes, cvel_data, force):
tasks.put(
Task(
ami_id,
user_data,
setup_disks,
instance_type,
obs_id,
snapshot_id,
created_by,
name,
spot_price,
instance_details,
frequency_groups,
counter
)
)
counter += 1
# Add a poison pill to shut things down
for x in range(processes):
tasks.put(None)
# Wait for the queue to terminate
tasks.join()
示例2: start_servers
# 需要导入模块: from common import LOGGER [as 别名]
# 或者: from common.LOGGER import warning [as 别名]
def start_servers(
ami_id,
user_data,
setup_disks,
instance_type,
obs_id,
created_by,
name,
instance_details,
spot_price):
snapshot_id = OBS_IDS.get(obs_id)
if snapshot_id is None:
LOGGER.warning('The obs-id: {0} does not exist in the settings file')
else:
ec2_helper = EC2Helper()
iops = None
if instance_details.iops_support:
iops = 500
zone = ec2_helper.get_cheapest_spot_price(instance_type, spot_price)
if zone is not None:
volume, snapshot_name = ec2_helper.create_volume(snapshot_id, zone, iops=iops)
LOGGER.info('obs_id: {0}, volume_name: {1}'.format(obs_id, snapshot_name))
now = datetime.datetime.now()
user_data_mime = get_mime_encoded_user_data(volume.id, setup_disks, user_data, now.strftime('%Y-%m-%dT%H-%M-%S'))
if spot_price is not None:
ec2_helper.run_spot_instance(
ami_id,
spot_price,
user_data_mime,
instance_type,
volume.id,
created_by,
'{1}-{0}'.format(name, snapshot_name),
instance_details,
zone,
ephemeral=True)
else:
LOGGER.error('Cannot get a spot instance of {0} for ${1}'.format(instance_type, spot_price))