def processJob(job): if job['status'] == 'error': return if job['status'] == 'new': print 'New Job...' updateJob(job['id'], job['branch'], job['buildername'], job['revision']) updateStatus(job['id'], 'updated') print 'Updated Job...' if job['status'] == 'updated': if not (job['buildrevs'] == ''): buildList = job['buildrevs'].split(',') for rev in buildList: print rev titanic.triggerBuild(job['branch'], job['buildername'], rev, auth) updateStatus(job['id'], 'building') print 'Building for Job...' if job['status'] == 'building': print 'Builds are triggered!' buildFlag = 1 revList = job['analyzerevs'].split(',') for rev in revList: if (titanic.isBuildPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isBuildRunning(job['branch'], job['buildername'], rev, auth)): buildFlag = 0 continue elif not titanic.isBuildSuccessful(job['branch'], job['buildername'], rev): print 'Error: For ' + rev + ' ' + job['buildername'] updateStatus(job['id'], 'error') buildFlag = 0 continue if buildFlag: print 'Builds are done!' for rev in revList: titanic.triggerJob(job['branch'], job['buildername'], rev, auth) if not (titanic.isJobPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isJobRunning(job['branch'], job['buildername'], rev, auth)): updateStatus(job['id'], 'error') continue updateStatus(job['id'], 'running') print 'Running Jobs...' if job['status'] == 'running': doneFlag = 1 revList = job['analyzerevs'].split(',') for rev in revList: if (titanic.isJobPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isJobRunning(job['branch'], job['buildername'], rev, auth)): doneFlag = 0 if doneFlag: updateStatus(job['id'], 'done') print 'Done'
def processJob(job): if job['status'] == 'new': print 'New Job...' job,retVal = updateJob(job) job = updateStatus(job, retVal) print 'Updated Job..' if job['status'] == 'updated': if (job['buildrevs'] == '') and (job['analyzerevs'] == ''): job = updateStatus(job, 'done') return if not (job['buildrevs'] == ''): buildList = job['buildrevs'].split(',') for rev in buildList: if not (titanic.isBuildPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isBuildRunning(job['branch'], job['buildername'], rev, auth)): titanic.triggerBuild(job['branch'], job['buildername'], rev, auth) job = updateStatus(job, 'building') print 'Building for Job...' if job['status'] == 'building': print 'Builds are triggered!' buildFlag = 1 revList = job['analyzerevs'].split(',') for rev in revList: if (titanic.isBuildPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isBuildRunning(job['branch'], job['buildername'], rev, auth)): buildFlag = 0 continue elif not titanic.isBuildSuccessful(job['branch'], job['buildername'], rev): print 'Error: For ' + rev + ' ' + job['buildername'] job = updateStatus(job, 'error') buildFlag = 0 continue if buildFlag: print 'Builds are done!' for rev in revList: titanic.triggerJob(job['branch'], job['buildername'], rev, auth) if 'talos' in job['buildername']: titanic.triggerJob(job['branch'], job['buildername'], rev, auth) titanic.triggerJob(job['branch'], job['buildername'], rev, auth) job = updateStatus(job, 'running') print 'Running Jobs...' if job['status'] == 'running': doneFlag = 1 revList = job['analyzerevs'].split(',') for rev in revList: if (titanic.isJobPending(job['branch'], job['buildername'], rev, auth) \ or titanic.isJobRunning(job['branch'], job['buildername'], rev, auth)): doneFlag = 0 if doneFlag: job = updateStatus(job, 'done') print 'Done' if job['status'] == 'error': return if job['status'] == 'bounds-error': print 'Too many builds or revisions to be analyzed' return
import sys buildername = 'Windows 7 32-bit mozilla-central debug test mochitest-1' branch = 'mozilla-central' delta = 30 revision = 'cd2acc7ab2f8' revList, buildList = titanic.runAnalysis( branch, buildername, revision, delta) for rev in buildList: if not (titanic.isBuildPending(branch, buildername, rev) \ or titanic.isBuildRunning(branch, buildername, rev)): titanic.triggerBuild(branch, buildername, rev) else: if not titanic.isBuildSuccessful(branch, buildername, revision): print 'Builds are yet to be completed for revision ' + rev + ' ...' print 'If the builds have been running for a very long time make sure the builds have not failed!' if buildList != []: sys.exit(1) print 'All builds are completed. Starting Jobs...' for rev in revList: if not (titanic.isJobPending(branch, buildername, rev) \ or titanic.isJobRunning(branch, buildername, rev)): titanic.triggerJob(branch, buildername, rev) else: print 'Job has already been triggered'