Merge pull request #515 from mjibson/monitor-build-node-queue

Monitor queue adds and EC2 node starts
This commit is contained in:
Matt Jibson 2015-09-18 16:28:46 -04:00
commit aa8ee4db64
2 changed files with 6 additions and 1 deletions

View file

@ -10,6 +10,7 @@ from trollius import From, coroutine, Return, async
from concurrent.futures import ThreadPoolExecutor
from urllib3.exceptions import ReadTimeoutError, ProtocolError
from app import metric_queue
from buildman.manager.basemanager import BaseManager
from buildman.manager.executor import PopenExecutor, EC2Executor
from buildman.component.buildcomponent import BuildComponent
@ -335,6 +336,7 @@ class EphemeralBuilderManager(BaseManager):
try:
builder_id = yield From(self._executor.start_builder(realm, token, build_uuid))
metric_queue.put('EC2BuilderStarted', 1, unit='Count')
except:
logger.exception('Exception when starting builder for job: %s', build_uuid)
raise Return(False, EC2_API_TIMEOUT)

View file

@ -127,7 +127,10 @@ class WorkQueue(object):
params['available_after'] = available_date
with self._transaction_factory(db):
return str(QueueItem.create(**params).id)
r = str(QueueItem.create(**params).id)
if self._metric_queue:
self._metric_queue.put('Added', 1, dimensions={'queue': self._queue_name})
return r
def get(self, processing_time=300):
"""