Send the correct phase when setting the phase from job_complete

This commit is contained in:
Joseph Schorr 2016-09-30 21:26:45 +02:00
parent 07e23a34ed
commit a8bc4bf697
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,5 @@
from data.database import BUILD_PHASE
class BuildJobResult(object): class BuildJobResult(object):
""" Build job result enum """ """ Build job result enum """
INCOMPLETE = 'incomplete' INCOMPLETE = 'incomplete'
@ -11,3 +13,9 @@ class BuildServerStatus(object):
RUNNING = 'running' RUNNING = 'running'
SHUTDOWN = 'shutting_down' SHUTDOWN = 'shutting_down'
EXCEPTION = 'exception' EXCEPTION = 'exception'
RESULT_PHASES = {
BuildJobResult.INCOMPLETE: BUILD_PHASE.INTERNAL_ERROR,
BuildJobResult.COMPLETE: BUILD_PHASE.COMPLETE,
BuildJobResult.ERROR: BUILD_PHASE.ERROR,
}

View file

@ -12,7 +12,7 @@ from threading import Event
from trollius.coroutines import From from trollius.coroutines import From
from datetime import timedelta from datetime import timedelta
from buildman.enums import BuildJobResult, BuildServerStatus from buildman.enums import BuildJobResult, BuildServerStatus, RESULT_PHASES
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
@ -149,7 +149,7 @@ class BuilderServer(object):
if update_phase: if update_phase:
status_handler = StatusHandler(self._build_logs, build_job.repo_build.uuid) status_handler = StatusHandler(self._build_logs, build_job.repo_build.uuid)
status_handler.set_phase(job_status) status_handler.set_phase(RESULT_PHASE[job_status])
self._job_count = self._job_count - 1 self._job_count = self._job_count - 1