{# Single-execution detail page. This intentionally follows opportunities/detail.html's visual grammar: back link, header card, one-line summary, cohesive stat strip, trend, issue rows, query, and evidence panels. The content stays job-specific, but the page should feel like the same product surface. #} {% extends "layout.html" %} {% block content %} {% from "components/_page_header.html" import back_link, header_card %} {% from "components/_section_title.html" import section_title %} {% from "components/_signal_chip.html" import signal_chip %} {% from "components/_sql_panel.html" import sql_panel %}
{% if request.query_params.get('from') == 'cohort' and job.destination_table and job.destination_table != '-' %} {{ back_link("/jobs/" ~ job.destination_table ~ "#execution-" ~ job.job_id, "Back to job history") }} {% endif %} {{ back_link("/dashboard", "Dashboard") }}
{% if job.destination_table and job.destination_table != '-' %} {% set _title %}{{ job.destination_short }}{% endset %} {% else %} {% set _title %}{{ job.job_id }}{% endset %} {% endif %} {% call header_card(_title) %} {% if job.workload_kind == "build" %} {{ signal_chip("Build", color="brand", title="Build - this query writes a destination table") }} {% elif job.workload_kind == "consumption" %} {{ signal_chip("Consumption", color="teal", title="Consumption - read-only query, no destination written") }} {% endif %} {% if job.is_dbt_originated or job.origin_tool == "dbt" %} dbt {% endif %} {% if job.user_email and job.user_email != "-" %} {% set _author_label %}{{ job.user_email }}{% endset %} {{ signal_chip(_author_label, color="slate") }} {% endif %} {% if job.origin_tool and job.origin_tool != "ad_hoc" and not (job.origin_tool == "dbt" and job.is_dbt_originated) %} {% set _origin_label %}{{ job.origin_tool | replace('_', ' ') }}{% endset %} {{ signal_chip(_origin_label, color="slate") }} {% endif %} {{ job.job_id }} {{ job.statement_type }} {% if job.cache_hit %} {{ signal_chip("Cache hit", color="slate") }} {% endif %} {% endcall %} {%- set _scan_cost = cohort_aggregates.cost_usd if cohort_aggregates else job.cost_usd -%} {%- set _runs = cohort_aggregates.execution_count if (cohort_aggregates and cohort_aggregates.execution_count) else 1 -%}

{{ issue_count }} issue{{ '' if issue_count == 1 else 's' }} · {{ suggestion_count }} suggestion{{ '' if suggestion_count == 1 else 's' }} · {{ _scan_cost | format_usd }} in the scan window

{# Same four-column stat grammar as opportunity detail. The primary values are aggregated across the destination table when a cohort exists; the muted line shows the latest execution snapshot. #} {%- set _last_ts = latest_execution.creation_time.strftime("%Y-%m-%d %H:%M UTC") if (latest_execution and latest_execution.creation_time) else "" -%} {%- set _agg_bytes = cohort_aggregates.bytes_processed if cohort_aggregates else job.bytes_processed -%} {%- set _agg_slot_ms = cohort_aggregates.slot_time_ms if cohort_aggregates else job.slot_time_ms -%} {%- set _cost_meta = ( "last " ~ (latest_execution.cost_usd | format_usd) ~ ((" / " ~ _last_ts) if _last_ts else "") ) if latest_execution else None -%} {%- set _bytes_meta = ( "last " ~ (latest_execution.bytes_processed | format_bytes) ~ ((" / billed " ~ (latest_execution.bytes_billed | format_bytes)) if latest_execution.bytes_billed is not none else "") ) if (latest_execution and latest_execution.bytes_processed is not none) else None -%} {%- set _slot_meta = ( ("last " ~ (latest_execution.duration_ms | format_duration) ~ " wall") if (latest_execution and latest_execution.duration_ms is not none) else None ) -%}

Cost

{{ _scan_cost | format_usd }}

{% if _cost_meta %}

{{ _cost_meta }}

{% endif %}

Bytes processed

{{ (_agg_bytes | format_bytes) if _agg_bytes is not none else "-" }}

{% if _bytes_meta %}

{{ _bytes_meta }}

{% endif %}

Slot time

{{ ("%.1f" | format((_agg_slot_ms or 0) / 3600000) ~ " hrs") if _agg_slot_ms is not none else "-" }}

{% if _slot_meta %}

{{ _slot_meta }}

{% endif %}

Executions

{{ "{:,}".format(_runs) }}

in scan window

{% if chart_points_payload %} {% set chart_title = "Cost trend and issues" %} {# Subtitle is derived from the payload granularity inside the partial (per-execution vs daily roll-up), so we don't hard-code "per day". #} {% set chart_collapsible = true %} {% set chart_history_href = "/jobs/" ~ job.destination_table %} {% include "jobs/_cost_chart.html" %} {% endif %} {% if issue_count %}
{{ section_title( "Issues found", description="One card per issue that fired on this job. Each row pairs the issue's evidence with the related opportunity.", aside=(issue_count ~ (" issue" if issue_count == 1 else " issues")) ) }}
{% for issue in issues %} {% if issue.is_issue %}

{{ issue.display_name | upper }}

Why it fired

{% if issue.explanation %}

{{ issue.explanation }}

{% endif %} {% if issue.rule_description %}

{{ issue.rule_description }}

{% endif %}

Recommended response

{% if suggestion_count %}

Review the available improvements below for the matching rewrite or structural recommendation.

{% else %}

No single-query SQL rewrite applies. The fix is at the workload-scheduling, slot-reservation, or schema layer.

{% endif %} View opportunity
{% endif %} {% endfor %}
{% endif %} {% if suggestion_count %}
{{ section_title( "Available improvements", description="Suggestion-class opportunities associated with this job.", aside=(suggestion_count ~ (" suggestion" if suggestion_count == 1 else " suggestions")) ) }}
{% for issue in issues %} {% if not issue.is_issue %}
{{ issue.display_name }} suggestion {{ issue.current_cost | format_usd }}
{% if issue.explanation %}

{{ issue.explanation }}

{% endif %} {% if issue.rule_description %}

{{ issue.rule_description }}

{% endif %} View opportunity
{% endif %} {% endfor %}
{% endif %} {% if job.query %} {% set _minimize_query = not suggestion_count %} {% if _minimize_query %}

Query

No deterministic SQL rewrite is available. Expand only when you need to inspect this execution.

minimized
{% else %}
{{ section_title( "Query", description="The SQL text cached for this execution." ) }} {% endif %}
{% for line in job.query.split('\n') %}{{ loop.index }}{{ line }}
{% endfor %}
{% if _minimize_query %}
{% else %}
{% endif %} {% endif %} {% if visible_evidence or job_lookup_sql %}
{% if visible_evidence %}

Evidence

{% for key, value in visible_evidence.items() %}
{{ key }}
{% if value is mapping or (value is iterable and value is not string) %} {{ value | tojson }} {% else %} {{ value }} {% endif %}
{% endfor %}
{% endif %} {% if job_lookup_sql %} {{ sql_panel("job-lookup-sql", "BigQuery query", job_lookup_sql) }} {% endif %}
{% endif %}
{% endblock %}