Merge pull request #1556 from coreos-inc/builder-cloudwatch
Add a cloud watch metric when we fail to start a build via EC2
This commit is contained in:
commit
f3204daa0c
1 changed files with 15 additions and 9 deletions
|
@ -14,6 +14,7 @@ from functools import partial
|
||||||
|
|
||||||
from buildman.asyncutil import AsyncWrapper
|
from buildman.asyncutil import AsyncWrapper
|
||||||
from container_cloud_config import CloudConfigContext
|
from container_cloud_config import CloudConfigContext
|
||||||
|
from app import metric_queue
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -136,6 +137,7 @@ class EC2Executor(BuilderExecutor):
|
||||||
)
|
)
|
||||||
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
||||||
|
|
||||||
|
try:
|
||||||
reservation = yield From(ec2_conn.run_instances(
|
reservation = yield From(ec2_conn.run_instances(
|
||||||
coreos_ami,
|
coreos_ami,
|
||||||
instance_type=self.executor_config['EC2_INSTANCE_TYPE'],
|
instance_type=self.executor_config['EC2_INSTANCE_TYPE'],
|
||||||
|
@ -145,6 +147,10 @@ class EC2Executor(BuilderExecutor):
|
||||||
block_device_map=block_devices,
|
block_device_map=block_devices,
|
||||||
network_interfaces=interfaces,
|
network_interfaces=interfaces,
|
||||||
))
|
))
|
||||||
|
except boto.exception.EC2ResponseError as ec2e:
|
||||||
|
logger.exception('Unable to spawn builder instance')
|
||||||
|
metric_queue.put('EC2BuildStartFailure', 1, unit='Count')
|
||||||
|
raise ec2e
|
||||||
|
|
||||||
if not reservation.instances:
|
if not reservation.instances:
|
||||||
raise ExecutorException('Unable to spawn builder instance.')
|
raise ExecutorException('Unable to spawn builder instance.')
|
||||||
|
|
Reference in a new issue