示例#1
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        log_id = int(self.request.get('id', 0))

        log = ReportLog.get_by_id(log_id)
        if not log or not log.commit:
            self.response.out.write("Not processed")
            return

        branch = log.branch()
        platform = log.platform()
        build = Build.get_or_insert_from_log(log)

        for test_name, result_value in log.results().iteritems():
            test = Test.update_or_insert(test_name, branch, platform)
            result = TestResult.get_or_insert_from_parsed_json(test_name, build, result_value)
            runs = Runs.get_by_objects(branch, platform, test)
            regenerate_runs = True
            if runs:
                runs.update_incrementally(build, result)
                regenerate_runs = False
            schedule_runs_update(test.id, branch.id, platform.id, regenerate_runs)

        log = ReportLog.get(log.key())
        log.delete()

        # We need to update dashboard and manifest because they are affected by the existance of test results
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
示例#2
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        try:
            payload = json.loads(self.request.body)
            hide = payload['hide']
        except:
            self.response.out.write("Failed to parse the payload: %s" % self.request.body)
            return

        if 'platform' in payload:
            model = Platform.get_by_key_name(payload['platform'])
        elif 'test' in payload:
            model = Test.get_by_key_name(payload['test'])
        else:
            self.response.out.write('Not supported')
            return

        if not model:
            self.response.out.write('Could not find the model')
            return

        model.hidden = hide
        model.put()
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
示例#3
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        try:
            payload = json.loads(self.request.body)
            hide = payload['hide']
        except:
            self.response.out.write("Failed to parse the payload: %s" %
                                    self.request.body)
            return

        if 'platform' in payload:
            model = Platform.get_by_key_name(payload['platform'])
        elif 'test' in payload:
            model = Test.get_by_key_name(payload['test'])
        else:
            self.response.out.write('Not supported')
            return

        if not model:
            self.response.out.write('Could not find the model')
            return

        model.hidden = hide
        model.put()
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
示例#4
0
    def post(self, task):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        if task != 'run':
            try:
                payload = json.loads(self.request.body)
                merge = payload.get('merge', '')
                into = payload.get('into', '')
            except:
                self.response.out.write("Failed to parse the payload: %s" %
                                        self.request.body)
                return

            if merge == into or not Test.get_by_key_name(
                    merge) or not Test.get_by_key_name(into):
                self.response.out.write('Invalid test names')
                return

            taskqueue.add(url='/admin/merge-tests/run',
                          params={
                              'merge': merge,
                              'into': into
                          },
                          target='model-manipulator')
            self.response.out.write('OK')
            return

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))

        branches_and_platforms_to_update = into.merge(merge)
        if branches_and_platforms_to_update == None:
            # FIXME: This message is invisible. Need to store this somewhere and let the admin page pull it.
            self.response.out.write(
                'Cannot merge %s into %s. There are conflicting results.' %
                (merge.name, into.name))
            return

        for branch_id, platform_id in branches_and_platforms_to_update:
            schedule_runs_update(into.id, branch_id, platform_id)

        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
示例#5
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        log_id = int(self.request.get('id', 0))

        log = ReportLog.get_by_id(log_id)
        if not log or not log.commit:
            self.response.out.write("Not processed")
            return

        branch = log.branch()
        platform = log.platform()
        build = Build.get_or_insert_from_log(log)

        for test_name, result_value in log.results().iteritems():
            unit = result_value.get('unit') if isinstance(result_value,
                                                          dict) else None
            test = Test.update_or_insert(test_name, branch, platform, unit)
            result = TestResult.get_or_insert_from_parsed_json(
                test_name, build, result_value)
            if not result:
                continue
            runs = Runs.get_by_objects(branch, platform, test)
            regenerate_runs = True
            if runs:
                runs.update_incrementally(build, result)
                regenerate_runs = False
            schedule_runs_update(test.id, branch.id, platform.id,
                                 regenerate_runs)

        log = ReportLog.get(log.key())
        log.delete()

        # We need to update dashboard and manifest because they are affected by the existance of test results
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
示例#6
0
    def post(self, task):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        if task != 'run':
            try:
                payload = json.loads(self.request.body)
                merge = payload.get('merge', '')
                into = payload.get('into', '')
            except:
                self.response.out.write("Failed to parse the payload: %s" % self.request.body)
                return

            if merge == into or not Test.get_by_key_name(merge) or not Test.get_by_key_name(into):
                self.response.out.write('Invalid test names')
                return

            taskqueue.add(url='/admin/merge-tests/run', params={'merge': merge, 'into': into}, target='model-manipulator')
            self.response.out.write('OK')
            return

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))

        branches_and_platforms_to_update = into.merge(merge)
        if branches_and_platforms_to_update == None:
            # FIXME: This message is invisible. Need to store this somewhere and let the admin page pull it.
            self.response.out.write('Cannot merge %s into %s. There are conflicting results.' % (merge.name, into.name))
            return

        for branch_id, platform_id in branches_and_platforms_to_update:
            schedule_runs_update(into.id, branch_id, platform_id)

        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')