buildreporter: move reporting into server callback

This commit is contained in:
Jimmy Zelinskie 2015-02-17 15:31:53 -05:00
parent 25fc999d50
commit d70c95e42e
3 changed files with 3 additions and 6 deletions

View file

@ -1,7 +1,6 @@
import logging import logging
import uuid import uuid
from app import build_metrics
from buildman.component.basecomponent import BaseComponent from buildman.component.basecomponent import BaseComponent
from buildman.component.buildcomponent import BuildComponent from buildman.component.buildcomponent import BuildComponent
from buildman.manager.basemanager import BaseManager from buildman.manager.basemanager import BaseManager
@ -76,7 +75,6 @@ class EnterpriseManager(BaseManager):
@coroutine @coroutine
def job_completed(self, build_job, job_status, build_component): def job_completed(self, build_job, job_status, build_component):
build_metrics.report(job_status)
self.job_complete_callback(build_job, job_status) self.job_complete_callback(build_job, job_status)
def build_component_disposed(self, build_component, timed_out): def build_component_disposed(self, build_component, timed_out):

View file

@ -10,7 +10,6 @@ from trollius import From, coroutine, Return, async
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from urllib3.exceptions import ReadTimeoutError, ProtocolError from urllib3.exceptions import ReadTimeoutError, ProtocolError
from app import build_metrics
from buildman.manager.basemanager import BaseManager from buildman.manager.basemanager import BaseManager
from buildman.manager.executor import PopenExecutor, EC2Executor from buildman.manager.executor import PopenExecutor, EC2Executor
from buildman.component.buildcomponent import BuildComponent from buildman.component.buildcomponent import BuildComponent
@ -287,8 +286,6 @@ class EphemeralBuilderManager(BaseManager):
job_key = self._etcd_job_key(build_job) job_key = self._etcd_job_key(build_job)
yield From(self._etcd_client.delete(job_key)) yield From(self._etcd_client.delete(job_key))
build_metrics.report(job_status)
self.job_complete_callback(build_job, job_status) self.job_complete_callback(build_job, job_status)
@coroutine @coroutine

View file

@ -15,7 +15,7 @@ from datetime import timedelta
from buildman.jobutil.buildstatus import StatusHandler from buildman.jobutil.buildstatus import StatusHandler
from buildman.jobutil.buildjob import BuildJob, BuildJobLoadException from buildman.jobutil.buildjob import BuildJob, BuildJobLoadException
from data import database from data import database
from app import app from app import app, build_metrics
# pylint: disable=invalid-name # pylint: disable=invalid-name
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -135,6 +135,8 @@ class BuilderServer(object):
minimum_extension=MINIMUM_JOB_EXTENSION) minimum_extension=MINIMUM_JOB_EXTENSION)
def _job_complete(self, build_job, job_status): def _job_complete(self, build_job, job_status):
build_metrics.report(job_status)
if job_status == BuildJobResult.INCOMPLETE: if job_status == BuildJobResult.INCOMPLETE:
self._queue.incomplete(build_job.job_item, restore_retry=False, retry_after=30) self._queue.incomplete(build_job.job_item, restore_retry=False, retry_after=30)
else: else: