Exemplo n.º 1
0
    def store_text_log_summary(self, job, text_log_summary_artifact):
        """
        Store the contents of the text log summary artifact
        """
        step_data = json.loads(text_log_summary_artifact['blob'])['step_data']
        result_map = {v: k for (k, v) in TextLogStep.RESULTS}
        for step in step_data['steps']:
            name = step['name'][:TextLogStep._meta.get_field('name').
                                max_length]
            defaults = {'name': name, 'result': result_map[step['result']]}
            # process start/end times if we have them
            # we currently don't support timezones in treeherder, so
            # just ignore that when importing/updating the bug to avoid
            # a ValueError (though by default the text log summaries
            # we produce should have time expressed in UTC anyway)
            for tkey in ('started', 'finished'):
                if step.get(tkey):
                    defaults[tkey] = dateutil.parser.parse(step[tkey],
                                                           ignoretz=True)

            log_step, _ = TextLogStep.objects.update_or_create(
                job=job,
                started_line_number=step['started_linenumber'],
                finished_line_number=step['finished_linenumber'],
                defaults=defaults)

            if step.get('errors'):
                for error in step['errors']:
                    TextLogError.objects.update_or_create(
                        step=log_step,
                        line_number=error['linenumber'],
                        defaults={'line': astral_filter(error['line'])})

        # create a set of bug suggestions immediately
        load_error_summary(job.repository.name, job.id)
Exemplo n.º 2
0
def populate_error_summary(project, artifacts, job_id_lookup):
    """
    Create bug suggestions artifact(s) for any text_log_summary artifacts.

    ``artifacts`` here is a list of one or more ``text_log_summary`` artifacts.
    If any of them have ``error_lines``, then we generate the
    ``bug suggestions`` artifact from them.
    """

    load_error_summary(project, artifacts, job_id_lookup)
Exemplo n.º 3
0
def populate_error_summary(project, artifacts, job_id_lookup):
    """
    Create bug suggestions artifact(s) for any text_log_summary artifacts.

    ``artifacts`` here is a list of one or more ``text_log_summary`` artifacts.
    If any of them have ``error_lines``, then we generate the
    ``bug suggestions`` artifact from them.
    """

    load_error_summary(project, artifacts, job_id_lookup)
Exemplo n.º 4
0
def populate_error_summary(project, artifacts):
    """
    Create bug suggestions artifact(s) for any text_log_summary artifacts.

    ``artifacts`` here is a list of one or more ``text_log_summary`` artifacts.
    If any of them have ``error_lines``, then we generate the
    ``bug suggestions`` artifact from them.
    """
    newrelic.agent.add_custom_parameter("project", project)
    load_error_summary(project, artifacts)
Exemplo n.º 5
0
def populate_error_summary(project, artifacts):
    """
    Create bug suggestions artifact(s) for any text_log_summary artifacts.

    ``artifacts`` here is a list of one or more ``text_log_summary`` artifacts.
    If any of them have ``error_lines``, then we generate the
    ``bug suggestions`` artifact from them.
    """
    newrelic.agent.add_custom_parameter("project", project)
    load_error_summary(project, artifacts)