コード例 #1
0
ファイル: jobs.py プロジェクト: oulan/oppia
def _get_job_dict_from_job_model(model):
    """Converts an ndb.Model representing a job to a dict.

    The dict contains the following keys:
    - 'id': the job id
    - 'time_started_msec': when the job was started, in milliseconds since the
          epoch
    - 'time_finished_msec': when the job was finished, in milliseconds since
          the epoch
    - 'status_code': the current status of the job
    - 'job_type': the type of this job
    - 'is_cancelable': whether the job can be canceled
    - 'error': any errors pertaining to this job
    - 'human_readable_time_started': a human-readable string representing the
          time the job started, or None if time_started_msec is None.
    - 'human_readable_time_finished': a human-readable string representing the
          time the job finished, or None if time_finished_msec is None.
    """
    return {
        'id': model.id,
        'time_started_msec': model.time_started_msec,
        'time_finished_msec': model.time_finished_msec,
        'status_code': model.status_code,
        'job_type': model.job_type,
        'is_cancelable': model.is_cancelable,
        'error': model.error,
        'human_readable_time_started': (
            '' if model.time_started_msec is None
            else utils.get_human_readable_time_string(model.time_started_msec)),
        'human_readable_time_finished': (
            '' if model.time_finished_msec is None
            else utils.get_human_readable_time_string(
                model.time_finished_msec)),
    }
コード例 #2
0
ファイル: jobs.py プロジェクト: VictoriaRoux/oppia
def _get_job_dict_from_job_model(model):
    """Converts an ndb.Model representing a job to a dict.

    The dict contains the following keys:
    - 'id': the job id
    - 'time_started_msec': when the job was started, in milliseconds since the
          epoch
    - 'time_finished_msec': when the job was finished, in milliseconds since
          the epoch
    - 'status_code': the current status of the job
    - 'job_type': the type of this job
    - 'is_cancelable': whether the job can be canceled
    - 'error': any errors pertaining to this job
    - 'human_readable_time_started': a human-readable string representing the
          time the job started, or None if time_started_msec is None.
    - 'human_readable_time_finished': a human-readable string representing the
          time the job finished, or None if time_finished_msec is None.
    """
    return {
        'id': model.id,
        'time_started_msec': model.time_started_msec,
        'time_finished_msec': model.time_finished_msec,
        'status_code': model.status_code,
        'job_type': model.job_type,
        'is_cancelable': model.is_cancelable,
        'error': model.error,
        'human_readable_time_started': (
            '' if model.time_started_msec is None
            else utils.get_human_readable_time_string(model.time_started_msec)),
        'human_readable_time_finished': (
            '' if model.time_finished_msec is None
            else utils.get_human_readable_time_string(
                model.time_finished_msec)),
    }
コード例 #3
0
    def get(self):
        """Handles GET requests."""
        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()

        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in (jobs_registry.ONE_OFF_JOB_MANAGERS +
                              (jobs_registry.AUDIT_JOB_MANAGERS))
            ])

        queued_or_running_job_types = set(
            [job['job_type'] for job in unfinished_job_data])
        one_off_job_status_summaries = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]
        audit_job_status_summaries = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.AUDIT_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.render_json({
            'continuous_computations_data':
            continuous_computations_data,
            'human_readable_current_time':
            (utils.get_human_readable_time_string(
                utils.get_current_time_in_millisecs())),
            'one_off_job_status_summaries':
            one_off_job_status_summaries,
            'audit_job_status_summaries':
            audit_job_status_summaries,
            'recent_job_data':
            recent_job_data,
            'unfinished_job_data':
            unfinished_job_data,
        })
コード例 #4
0
ファイル: admin.py プロジェクト: 526avijitgupta/oppia
    def get(self):
        """Handles GET requests."""
        demo_exploration_ids = feconf.DEMO_EXPLORATIONS.keys()

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in jobs_registry.ONE_OFF_JOB_MANAGERS])

        queued_or_running_job_types = set([
            job['job_type'] for job in unfinished_job_data])
        one_off_job_specs = [{
            'job_type': klass.__name__,
            'is_queued_or_running': (
                klass.__name__ in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.values.update({
            'continuous_computations_data': continuous_computations_data,
            'demo_collections': sorted(feconf.DEMO_COLLECTIONS.iteritems()),
            'demo_explorations': sorted(feconf.DEMO_EXPLORATIONS.iteritems()),
            'demo_exploration_ids': demo_exploration_ids,
            'human_readable_current_time': (
                utils.get_human_readable_time_string(
                    utils.get_current_time_in_millisecs())),
            'one_off_job_specs': one_off_job_specs,
            'recent_job_data': recent_job_data,
            'rte_components_html': jinja2.utils.Markup(
                rte_component_registry.Registry.get_html_for_all_components()),
            'unfinished_job_data': unfinished_job_data,
            'value_generators_js': jinja2.utils.Markup(
                editor.get_value_generators_js()),
        })

        self.render_template('pages/admin/admin.html')
コード例 #5
0
    def get(self):
        """Handles GET requests."""
        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()

        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in (
                    jobs_registry.ONE_OFF_JOB_MANAGERS + (
                        jobs_registry.AUDIT_JOB_MANAGERS))])

        queued_or_running_job_types = set([
            job['job_type'] for job in unfinished_job_data])
        one_off_job_status_summaries = [{
            'job_type': klass.__name__,
            'is_queued_or_running': (
                klass.__name__ in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]
        audit_job_status_summaries = [{
            'job_type': klass.__name__,
            'is_queued_or_running': (
                klass.__name__ in queued_or_running_job_types)
        } for klass in jobs_registry.AUDIT_JOB_MANAGERS]

        self.render_json({
            'human_readable_current_time': (
                utils.get_human_readable_time_string(
                    utils.get_current_time_in_millisecs())),
            'one_off_job_status_summaries': one_off_job_status_summaries,
            'audit_job_status_summaries': audit_job_status_summaries,
            'recent_job_data': recent_job_data,
            'unfinished_job_data': unfinished_job_data,
        })
コード例 #6
0
    def export_data(cls, user_id):
        """Exports the data from AppFeedbackReportModel into dict format for
        Takeout.

        Args:
            user_id: str. The ID of the user whose data should be exported;
                this would be the ID of the user who has scrubbed the report.

        Returns:
            dict. Dictionary of the data from AppFeedbackReportModel.
        """
        user_data = dict()
        report_models = cls.get_all().filter(
            cls.scrubbed_by == user_id).fetch()

        for report_model in report_models:
            submitted_on_msec = utils.get_time_in_millisecs(
                report_model.submitted_on)
            user_data[report_model.id] = {
                'scrubbed_by':
                report_model.scrubbed_by,
                'platform':
                report_model.platform,
                'ticket_id':
                report_model.ticket_id,
                'submitted_on':
                utils.get_human_readable_time_string(submitted_on_msec),
                'report_type':
                report_model.report_type,
                'category':
                report_model.category,
                'platform_version':
                report_model.platform_version
            }
        return user_data
コード例 #7
0
    def test_export_data_nontrivial(self):
        exported_data = (
            app_feedback_report_models.AppFeedbackReportModel.export_data(
                self.USER_ID))

        report_id = '%s.%s.%s' % (self.PLATFORM_ANDROID,
                                  int(self.REPORT_SUBMITTED_TIMESTAMP_1_MSEC),
                                  'randomInteger123')
        expected_data = {
            report_id: {
                'scrubbed_by':
                self.USER_ID,
                'platform':
                self.PLATFORM_ANDROID,
                'ticket_id':
                self.TICKET_ID,
                'submitted_on':
                utils.get_human_readable_time_string(
                    self.REPORT_SUBMITTED_TIMESTAMP_1_MSEC),
                'report_type':
                self.REPORT_TYPE_SUGGESTION,
                'category':
                self.CATEGORY_OTHER,
                'platform_version':
                self.PLATFORM_VERSION
            }
        }
        self.assertEqual(exported_data, expected_data)
コード例 #8
0
ファイル: jobs.py プロジェクト: ReshuKumari/oppia
def _get_job_dict_from_job_model(model):
    """Converts a Model representing a job to a dict.

    Args:
        model: datastore_services.Model. The model to extract job info from.

    Returns:
        dict. The dict contains the following keys:
            id: str. The ID of the job.
            time_started_msec: float. When the job was started, in milliseconds
                since the epoch.
            time_finished_msec: float. When the job was finished, in
                milliseconds since the epoch.
            status_code: str. The current status of the job.
            job_type: str. The type of this job.
            is_cancelable: bool. Whether the job can be canceled.
            error: str. Any errors pertaining to this job.
            human_readable_time_started: str or None. A human-readable string
                representing the time the job started, or None if
                time_started_msec is None.
            human_readable_time_finished: str or None. A human-readable string
                representing the time the job finished, or None if
                time_finished_msec is None.
    """
    return {
        'id':
        model.id,
        'time_started_msec':
        model.time_started_msec,
        'time_finished_msec':
        model.time_finished_msec,
        'status_code':
        model.status_code,
        'job_type':
        model.job_type,
        'is_cancelable':
        model.is_cancelable,
        'error':
        model.error,
        'human_readable_time_started':
        ('' if model.time_started_msec is None else
         utils.get_human_readable_time_string(model.time_started_msec)),
        'human_readable_time_finished':
        ('' if model.time_finished_msec is None else
         utils.get_human_readable_time_string(model.time_finished_msec)),
    }
コード例 #9
0
ファイル: admin.py プロジェクト: yudhik11/oppia
    def get(self):
        """Handles GET requests."""
        demo_exploration_ids = feconf.DEMO_EXPLORATIONS.keys()

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        topic_summaries = topic_services.get_all_topic_summaries()
        topic_summary_dicts = [
            summary.to_dict() for summary in topic_summaries
        ]
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in jobs_registry.ONE_OFF_JOB_MANAGERS
            ])

        queued_or_running_job_types = set(
            [job['job_type'] for job in unfinished_job_data])
        one_off_job_specs = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.values.update({
            'continuous_computations_data':
            continuous_computations_data,
            'demo_collections':
            sorted(feconf.DEMO_COLLECTIONS.iteritems()),
            'demo_explorations':
            sorted(feconf.DEMO_EXPLORATIONS.iteritems()),
            'demo_exploration_ids':
            demo_exploration_ids,
            'human_readable_current_time':
            (utils.get_human_readable_time_string(
                utils.get_current_time_in_millisecs())),
            'one_off_job_specs':
            one_off_job_specs,
            'recent_job_data':
            recent_job_data,
            'unfinished_job_data':
            unfinished_job_data,
            'value_generators_js':
            jinja2.utils.Markup(editor.get_value_generators_js()),
            'updatable_roles': {
                role: role_services.HUMAN_READABLE_ROLES[role]
                for role in role_services.UPDATABLE_ROLES
            },
            'viewable_roles': {
                role: role_services.HUMAN_READABLE_ROLES[role]
                for role in role_services.VIEWABLE_ROLES
            },
            'topic_summaries':
            topic_summary_dicts,
            'role_graph_data':
            role_services.get_role_graph_data()
        })

        self.render_template('pages/admin/admin.html')
コード例 #10
0
ファイル: admin.py プロジェクト: testMrinal/oppia
    def get(self):
        """Handles GET requests."""
        demo_exploration_ids = list(feconf.DEMO_EXPLORATIONS.keys())

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        topic_summaries = topic_services.get_all_topic_summaries()
        topic_summary_dicts = [
            summary.to_dict() for summary in topic_summaries
        ]
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in (jobs_registry.ONE_OFF_JOB_MANAGERS +
                              (jobs_registry.AUDIT_JOB_MANAGERS))
            ])

        queued_or_running_job_types = set(
            [job['job_type'] for job in unfinished_job_data])
        one_off_job_status_summaries = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]
        audit_job_status_summaries = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.AUDIT_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        feature_flag_dicts = feature_services.get_all_feature_flag_dicts()

        self.render_json({
            'config_properties':
            (config_domain.Registry.get_config_property_schemas()),
            'continuous_computations_data':
            continuous_computations_data,
            'demo_collections':
            sorted(feconf.DEMO_COLLECTIONS.items()),
            'demo_explorations':
            sorted(feconf.DEMO_EXPLORATIONS.items()),
            'demo_exploration_ids':
            demo_exploration_ids,
            'human_readable_current_time':
            (utils.get_human_readable_time_string(
                utils.get_current_time_in_millisecs())),
            'one_off_job_status_summaries':
            one_off_job_status_summaries,
            'audit_job_status_summaries':
            audit_job_status_summaries,
            'recent_job_data':
            recent_job_data,
            'unfinished_job_data':
            unfinished_job_data,
            'updatable_roles': {
                role: role_services.HUMAN_READABLE_ROLES[role]
                for role in role_services.UPDATABLE_ROLES
            },
            'viewable_roles': {
                role: role_services.HUMAN_READABLE_ROLES[role]
                for role in role_services.VIEWABLE_ROLES
            },
            'topic_summaries':
            topic_summary_dicts,
            'role_graph_data':
            role_services.get_role_graph_data(),
            'feature_flags':
            feature_flag_dicts,
        })
コード例 #11
0
ファイル: admin.py プロジェクト: luskjh/oppia
    def get(self):
        """Handles GET requests."""
        self.values['counters'] = [{
            'name': counter.name,
            'description': counter.description,
            'value': counter.value
        } for counter in counters.Registry.get_all_counters()]

        if counters.HTML_RESPONSE_COUNT.value:
            average_time = (
                counters.HTML_RESPONSE_TIME_SECS.value /
                counters.HTML_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-html-response-time-secs',
                'description': 'Average HTML response time in seconds',
                'value': average_time
            })

        if counters.JSON_RESPONSE_COUNT.value:
            average_time = (
                counters.JSON_RESPONSE_TIME_SECS.value /
                counters.JSON_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-json-response-time-secs',
                'description': 'Average JSON response time in seconds',
                'value': average_time
            })

        demo_exploration_ids = feconf.DEMO_EXPLORATIONS.keys()

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in jobs_registry.ONE_OFF_JOB_MANAGERS])

        queued_or_running_job_types = set([
            job['job_type'] for job in unfinished_job_data])
        one_off_job_specs = [{
            'job_type': klass.__name__,
            'is_queued_or_running': (
                klass.__name__ in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.values.update({
            'continuous_computations_data': continuous_computations_data,
            'demo_collections': sorted(feconf.DEMO_COLLECTIONS.iteritems()),
            'demo_explorations': sorted(feconf.DEMO_EXPLORATIONS.iteritems()),
            'demo_exploration_ids': demo_exploration_ids,
            'human_readable_current_time': (
                utils.get_human_readable_time_string(
                    utils.get_current_time_in_millisecs())),
            'one_off_job_specs': one_off_job_specs,
            'recent_job_data': recent_job_data,
            'rte_components_html': jinja2.utils.Markup(
                rte_component_registry.Registry.get_html_for_all_components()),
            'unfinished_job_data': unfinished_job_data,
            'value_generators_js': jinja2.utils.Markup(
                editor.VALUE_GENERATORS_JS.value),
        })

        self.render_template('admin/admin.html')
コード例 #12
0
    def get(self):
        """Handles GET requests."""
        self.values['counters'] = [{
            'name': counter.name,
            'description': counter.description,
            'value': counter.value
        } for counter in counters.Registry.get_all_counters()]

        if counters.HTML_RESPONSE_COUNT.value:
            average_time = (
                counters.HTML_RESPONSE_TIME_SECS.value /
                counters.HTML_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-html-response-time-secs',
                'description': 'Average HTML response time in seconds',
                'value': average_time
            })

        if counters.JSON_RESPONSE_COUNT.value:
            average_time = (
                counters.JSON_RESPONSE_TIME_SECS.value /
                counters.JSON_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-json-response-time-secs',
                'description': 'Average JSON response time in seconds',
                'value': average_time
            })

        demo_exploration_ids = feconf.DEMO_EXPLORATIONS.keys()

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in jobs_registry.ONE_OFF_JOB_MANAGERS])

        queued_or_running_job_types = set([
            job['job_type'] for job in unfinished_job_data])
        one_off_job_specs = [{
            'job_type': klass.__name__,
            'is_queued_or_running': (
                klass.__name__ in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.values.update({
            'continuous_computations_data': continuous_computations_data,
            'demo_collections': sorted(feconf.DEMO_COLLECTIONS.iteritems()),
            'demo_explorations': sorted(feconf.DEMO_EXPLORATIONS.iteritems()),
            'demo_exploration_ids': demo_exploration_ids,
            'human_readable_current_time': (
                utils.get_human_readable_time_string(
                    utils.get_current_time_in_millisecs())),
            'one_off_job_specs': one_off_job_specs,
            'recent_job_data': recent_job_data,
            'rte_components_html': jinja2.utils.Markup(
                rte_component_registry.Registry.get_html_for_all_components()),
            'unfinished_job_data': unfinished_job_data,
            'value_generators_js': jinja2.utils.Markup(
                editor.get_value_generators_js()),
        })

        self.render_template('admin/admin.html')
コード例 #13
0
ファイル: admin.py プロジェクト: miyucy/oppia
    def get(self):
        """Handles GET requests."""
        self.values['counters'] = [{
            'name': counter.name,
            'description': counter.description,
            'value': counter.value
        } for counter in counters.Registry.get_all_counters()]

        if counters.HTML_RESPONSE_COUNT.value:
            average_time = (counters.HTML_RESPONSE_TIME_SECS.value /
                            counters.HTML_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-html-response-time-secs',
                'description': 'Average HTML response time in seconds',
                'value': average_time
            })

        if counters.JSON_RESPONSE_COUNT.value:
            average_time = (counters.JSON_RESPONSE_TIME_SECS.value /
                            counters.JSON_RESPONSE_COUNT.value)
            self.values['counters'].append({
                'name': 'average-json-response-time-secs',
                'description': 'Average JSON response time in seconds',
                'value': average_time
            })

        demo_explorations = [
            (unicode(ind), exp[0])
            for ind, exp in enumerate(feconf.DEMO_EXPLORATIONS)
        ]

        recent_job_data = jobs.get_data_for_recent_jobs()
        unfinished_job_data = jobs.get_data_for_unfinished_jobs()
        for job in unfinished_job_data:
            job['can_be_canceled'] = job['is_cancelable'] and any([
                klass.__name__ == job['job_type']
                for klass in jobs_registry.ONE_OFF_JOB_MANAGERS
            ])

        queued_or_running_job_types = set(
            [job['job_type'] for job in unfinished_job_data])
        one_off_job_specs = [{
            'job_type':
            klass.__name__,
            'is_queued_or_running': (klass.__name__
                                     in queued_or_running_job_types)
        } for klass in jobs_registry.ONE_OFF_JOB_MANAGERS]

        continuous_computations_data = jobs.get_continuous_computations_info(
            jobs_registry.ALL_CONTINUOUS_COMPUTATION_MANAGERS)
        for computation in continuous_computations_data:
            if computation['last_started_msec']:
                computation['human_readable_last_started'] = (
                    utils.get_human_readable_time_string(
                        computation['last_started_msec']))
            if computation['last_stopped_msec']:
                computation['human_readable_last_stopped'] = (
                    utils.get_human_readable_time_string(
                        computation['last_stopped_msec']))
            if computation['last_finished_msec']:
                computation['human_readable_last_finished'] = (
                    utils.get_human_readable_time_string(
                        computation['last_finished_msec']))

        self.values.update({
            'demo_explorations':
            demo_explorations,
            'object_editors_js':
            jinja2.utils.Markup(editor.OBJECT_EDITORS_JS.value),
            'value_generators_js':
            jinja2.utils.Markup(editor.VALUE_GENERATORS_JS.value),
            'widget_js_directives':
            jinja2.utils.Markup(
                widget_registry.Registry.get_noninteractive_widget_js()),
            'one_off_job_specs':
            one_off_job_specs,
            'recent_job_data':
            recent_job_data,
            'unfinished_job_data':
            unfinished_job_data,
            'continuous_computations_data':
            continuous_computations_data,
        })

        self.render_template('admin/admin.html')